Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

insert autotext at bookmark

Status
Not open for further replies.

be17

Technical User
Feb 7, 2001
26
US

I need to write code that inserts a picture/logo (saved in autotext in
Word) into a bookmark in a Word template so that I can reference the
bookmark on the second page header. Normally when I insert text at a
bookmark I use code similar to this:

Set BMRange = ActiveDocument.Bookmarks("printedby").Range
BMRange.Text = txtNetworkID
ActiveDocument.Bookmarks.Add "printedby", BMRange

I am under the impression that the BMRange.Text = txtNetworkID inserts
the text inside of the bookmark, whereas code similar to that below
inserts the text next to, or following, the bookmark. Is this
correct?

Set myRange = .Bookmarks("reportstart").Range
Selection.Collapse Direction:=wdCollapseEnd
ActiveDocument.AttachedTemplate.AutoTextEntries("gniteem").Insert
_
Where:=myRange, RichText:=True
.Bookmarks.Add Name:="reportstart", Range:=myRange

My main question is: Is it possible to insert an autotext entry into
a bookmark, rather than at/next to a bookmark. The reason I ask is
because this picture/logo may change each time the document is
printed, and it would be fairly easy to change it if it was inserted
in the bookmark. However, if it is inserted after or next to the
bookmark, how do I go in and delete it if it needs to be changed?

I don't know too much about Visual Basic so if you have any other
suggestions for me that would be great. My overall goal is to prompt
the user (before they print) for their network ID and on the same
userform also have two option buttons where they will be forced to
select whether they will be printing to a color or b/w printer. If
they select the color option button, then the companies color logo
will be inserted in the header of the letterhead and if they select
the b/w printer then the b/w logo will be inserted in the header. I would also like to them reference this bookmark so that it shows up in the second page header as well.

Bronwyn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top