Headers and Footers

C

Carl

Hi all
I'm updating my code from WordBasic to Visual Basic. I
understand that Office XP has problems in this area in
particular with the header and footer thing.

Here is a sample of the code I have to insert a variable
into the header against a bookmark (rest of the code is
similar but ref the other headers).

Sub HeadFoot
dim strClass as string
WordBasic.NormalViewHeaderArea Type:=3, OddAndEvenPages:=1
ActiveDocument.Bookmarks("Class2").Select
Selection.TypeText Text:=strClass
WordBasic.ClosePane
End Sub

Is there a "neater" VB way?
 
D

Doug Robbins - Word MVP

Sure is!

ActiveDocument.Bookmarks("Class2").Range.InsertBefore strClass

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 

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