Results 1 to 8 of 8
  1. #1
    New Lounger
    Join Date
    Jul 2005
    Location
    Minneapolis, Minnesota, USA
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Bookmarks within autotext (VBA/XP/Word2000)

    I have a template which contains several optional paragraphs which I've placed into autotext. Inside two of the autotext paragraphs I have bookmarks.

    However, when I run the macro, the bookmarks within the autotext are not filled in. I have text boxes and labels for these bookmarks within the macro so the information is there, but it acts like it doesn't see the bookmarks.

    Any ideas?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Bookmarks within autotext (VBA/XP/Word2000)

    > when I run "the" macro

    Which macro? What does it do? What do you mean by "text boxes and labels ... within the macro"? A macro is a piece of VBA code...

  3. #3
    New Lounger
    Join Date
    Jul 2005
    Location
    Minneapolis, Minnesota, USA
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bookmarks within autotext (VBA/XP/Word2000)

    Sorry -- I'll try to be more clear.

    I have a template.
    Code containing user forms runs the template.
    Within the template I have multiple autotext entries.
    In the user form there is a checkbox which the user can check to insert one of these autotext entries into the template.
    These autotext entries contain bookmarks.
    The bookmarks are not "responsive" to the code.

    I hope I'm making some sense.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Bookmarks within autotext (VBA/XP/Word2000)

    Using bookmarks within an AutoText entry is tricky: you can insert one AutoText entry into several different locations in a document, but bookmark names must be unique. So the moment you insert the AutoText entry a second time, the bookmarks in the first instance go up in smoke.
    It should be possible, however, to manipulate the bookmarks in the most recently inserted instance in code.
    Please provide some details, or attach a stripped down and zipped copy of your template (make sure to remove sensitive information)

  5. #5
    New Lounger
    Join Date
    Jul 2005
    Location
    Minneapolis, Minnesota, USA
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bookmarks within autotext (VBA/XP/Word2000)

    I'm attaching the problem template. Please be kind as I've had no formal training in VBA -- I just manipulate it as best I can. The two autotext entries are SubAgt1 and SubAgt2. They have uniquely named bookmarks within them, but...

    Thanks for your help -- it is truly appreciated.

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Bookmarks within autotext (VBA/XP/Word2000)

    In the code module for SubAgt1:

    (1) Remove the End command which is terminating the procedure before you insert text to your bookmarks; it appears after the If structure for chbx3.

    (2) Put the statements similar to Selection.TypeText Text:=txtName1.Text inside the preceding If structures (otherwise they will be inserted in random locations).

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Bookmarks within autotext (VBA/XP/Word2000)

    The code never gets as far as inserting autotext, since the Next button on the first userform refers to lots of nonexisting bookmarks such as Pres, Treas, Secy etc.

  8. #8
    New Lounger
    Join Date
    Jul 2005
    Location
    Minneapolis, Minnesota, USA
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bookmarks within autotext (VBA/XP/Word2000)

    THANK YOU!!!

    You are a GENIUS -- that worked perfectly.

Posting Permissions

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