Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Apr 2010
    Location
    Enfield, CT
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    Hi there

    I need help with references and if statements. Here is what I am trying to do:

    I have an ask questions that is answered with a Y or N. If Y then I have two more ask questions that ask for dollar amounts.
    I then want the dollar amounts to appear in the body of the letter. How is this done?

    Also if the user selects N then I don't want anything to happen except for the letter to generate.

    Does anyone have any examples I could refer to?

    Thanks!

    -L

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts
    Hi L,

    Welcome to the Lounge!

    The logic you're describing probably requires some (relatively simple) VBA code - trying to do this with fields alone would probably be very complicated to do, if it can be done at all.

    If using code is something you'd consider, let me know and I'll post a sample.

    By the way, what version of Word are you using?

    Gary

  3. #3
    New Lounger
    Join Date
    Apr 2010
    Location
    Enfield, CT
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post

    Hi there and thanks for the Welcome Gary.

    I am using Word 2003 SP3

    Actually believe it or not I got it to work.

    But I would love to see a sample of code to do it in VBA. My way is a bit messy.

    Thanks!

    -L

  4. #4
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts
    L,

    Glad you got something to work. If you can, post a sample here so others can benefit from your solution.

    Attached is a demo of a way to do this with code. This was done as a simple quick exercise so there's no real letter content, and I didn't use styles, but it does illustrate the basic principles involved.

    Unzip the attachment to get to the .dot template.
    When you create a new document based on the template (you'll need to have macro security set to medium), a custom dialog will appear which will give you the option to include or not include dollar amounts in the letter.
    Then when you click on the OK button, the dollar amounts you entered get placed in bookmarked locations in the letter.

    If you press Alt+F11 you can take a look at the userform and code that was used to do this.

    Gary
    Attached Files Attached Files

Posting Permissions

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