Results 1 to 8 of 8

Thread: Beginner - start help

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2022
    Posts
    4

    Beginner - start help

    I hope someone will spend 5 minutes guiding me in the right direction. I have no experience with VC, but am curious about it.

    My goal is to create a Word document that presents the user with an input box when the document opens.
    The box must have the following data fields and a button:
    Title (text field)
    Start number (text field)
    Number (text field)
    Group (combobox)
    When the button is pressed, Word must generate labels with the "title" at the top. Below, the "start number" must appear. And at the bottom "group".
    First label must have "start number" applied, next label must have "start number" +1, next label "start number" +2, etc. The number of labels is defined by the field "number".

    Is it a difficult task to get started with as a beginner? And where do I start?

    I hope one of you will help me so I can succeed with my first VC project.

    Sincerely
    Mikkel

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    37,412

    Re: Beginner - start help

    There are several approaches to working with Word, some are easier than others. I only have limited experience with trying to automate word through Visual Studio (is that the VC you are talking about?), but found it to be quite horrible. The documentation is often wrong or absent, and the programming model...is a horrible mess. That means that there is a LOT of trial and error to getting things working. I ended up writing up a document with all the experiments I tried and the things I found out. Unfortunately, some of those things make no sense, while others were laughable. For example, there's a statement for adding things to a document that I found documented poorly, but used in numerous examples on Stack Overflow. Upon thorough testing, I was unable to show that the statement did anything at all. I couldn't find any difference between the results with and without the statement no matter what I tried.

    Another case was so bad I almost started a thread on here about it, except that it was hard to put into words what was happening. Essentially, if you called a function and passed it an argument, it would fail. If you passed that argument to a subroutine, without changing it in any discernible way, and then passed the argument to the same function, it would work fine. In other words, an object of type T, when passed as an argument of type T to a function I wrote, would behave differently than it did before it was passed, though there was no transformation happening as far as I could determine. That was maddening, because it meant that objects would magically change.

    In a small project, there were enough encounters of that nature that I was utterly frustrated with the programming model and was happy to walk away from it.

    Fortunately, it sounds like you might be able to create a Word template with a VBA macro. VBA is better documented...I hope. At the very least, it has been around longer and there is no way it could possibly be worse.
    My usual boring signature: Nothing

  3. #3
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    4,887

    Re: Beginner - start help

    What is VC???

    It would take longer than five minutes just to explain how to use the Visual Studio IDE. lol

    I think Shaggy's suggestion of using VBA might be the way to go. If you still want to use VB then check out some online tutorials and then post here when you get stuck.

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2022
    Posts
    4

    Re: Beginner - start help

    Sorry. VC should have been VB. Visual Basic. My bad.
    Okay. I will look up some tutorials and write again When Im stuck.
    Have a Nice weekend.

  5. #5

  6. #6
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    10,955

    Re: Beginner - start help

    Doing something like this in Visual Basic is pretty straight forward. Trying to generate a word document makes it a bit more difficult. Would you be opposed to just doing everything from VB?
    "Code is like humor. When you have to explain it, itís bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  7. #7

    Thread Starter
    New Member
    Join Date
    May 2022
    Posts
    4

    Re: Beginner - start help

    Thank you. I will look at it.

  8. #8

    Thread Starter
    New Member
    Join Date
    May 2022
    Posts
    4

    Re: Beginner - start help

    dday9

    I'm not sure what you mean about just doing it in VBA?
    The use of Word was just because it should print the labels on a Brother labelprinter.

    I'm really rookie at this point.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width