Go to a bookmark in the header in New Doc

I

ItsBarbara

Is there a way I can have the user go to a bookmark in the header upon
opening a template for the first time?I'm trying to make a document more
user friendly. The document is one created by the district that everyone on
staff needs to complete and there are a variety of abilities. I added a
hyperlink (hidden text) to get them out of the header after they enter the
Header Data....but many are frustrated upon getting into the header....
 
J

Jean-Guy Marcil

ItsBarbara was telling us:
ItsBarbara nous racontait que :
Is there a way I can have the user go to a bookmark in the header upon
opening a template for the first time?I'm trying to make a document
more user friendly. The document is one created by the district that
everyone on staff needs to complete and there are a variety of
abilities. I added a hyperlink (hidden text) to get them out of the
header after they enter the Header Data....but many are frustrated
upon getting into the header....

It is much easier to have a userform (or an InputBox if the text to enter is
short and simple) by means of which the user can type the desired text.
Then, the code inserts the text in the header without opening it.

Here is a simple example with an InputBox (You will need a Bookmark named
"Test" in the main header of section #1.)

'_______________________________________
Dim strText As String

strText = InputBox("Type your text:", "Header Data")

'Will equal "" when user hits Cancel
If strText = "" Then Exit Sub

ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary) _
.Range.Bookmarks("Test").Range.Text = strText
'_______________________________________

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top