Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Nov 2001
    Location
    Pittsburgh, PA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Search/remove textbox from Word Header (Word 2000)

    I'm fairly new to VBA but have been requested to create code to toggle inserting/removing a graphic image of our letterhead into a first page header. I started by creating autotext that contains the image in a text box. I can easily insert the autotext with code but am having difficulty searching for the text box, if it exists, and removing it. Is the best option to insert the image through the use of a textbox or is a frame easier to search for?

    If you have a suggestion for an easier way to accomplish this task, I would greatly appreciate hearing from you.

    Thanks,
    Kathy

  2. #2
    New Lounger
    Join Date
    Nov 2001
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Search/remove textbox from Word Header (Word 2000)

    Hi Kathy:

    There are a variety of ways this can be accomplished. First you can use a field code called autotext with the name of the autotext that contains the letterhead, place a style on it (maybe called letterhead) and just toggle its hidden attribute, some of the advantages to this method are: no need to update the documents when the letterhead changes,the user will always get the new letterhead, additional advantages include the fact that a user will always see on screen how the document looks if hidden text is turned on.

    With regards to textboxes, you can get to them througn the shapes collection, WordAssist (as you may already know) includes the automatic insertion and removal of "watermarks". These are basically autotext entries encapsulated in textboxes or images that can be automatically inserted and removed by a user, without requiring any programming on your part besides the creation of the textbox. Here is the basic line of code that would put you in the right direction

    if ActiveDocument.Sections(1).headers(wdHeadersFooter sFirstPage).shapes.count>0 then
    'loop through the shape collection until you find the one you want to remove
    end if

    Hope this helps. Contact me if you have further questions.

    Vick
    TSCG

  3. #3
    New Lounger
    Join Date
    Nov 2001
    Location
    Pittsburgh, PA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Search/remove textbox from Word Header (Word 2000)

    Thanks Vick!
    Love the idea of a style and toggling hidden text on and off. Thanks for the idea.

    Yes, I do remember WordAssist well. Wish I had it now. Unfortunately, I can't always have what I want. Nice to hear from you.

    Kathy

Posting Permissions

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