Header/Footer

S

scorpion53061

Maybe I was not paying attention but the code I used to create the header of
a document on the first page is not being used on subsequent pages.

Is there a way in code to tell it to do so?
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

It would be easier to tell if you showed us the code.

But to create a header on all pages, you would need to use:

With ActiveDocument.Sections(1)
.PageSetup.DifferentFirstPageHeaderFooter = True
.Headers(wdHeaderFooterFirstPage).Range.InsertBefore "First Page Header
Text"
.Headers(wdHeaderFooterPrimary).Range.InsertBefore "Other Pages Header
Text"
End With

or

With ActiveDocument.Sections(1)
.PageSetup.DifferentFirstPageHeaderFooter = False
.Headers(wdHeaderFooterPrimary).Range.InsertBefore "Common Header Text"
End With


--
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
 
S

scorpion53061

Hi Doug,

This worked great thank you.

DO you know anything about threading by chance?? :)
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

Threading as in Newsgroups?

--
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
 
P

Peter Hewett

Hi

I don't know if VBA is even threadsafe! Of all the VBA books I own and have
browsed through I can't even recall seeing "Threading" in the index! If I had
I'd have bought it.

I can recommend an excellent VB book that discusses Threading at length:

Advanced Visual Basic 6
Power Techniques for Everyday Programs
Author: Matthew Curland
Published by: Addison Wesley
ISBN: 0-201-70712-8

A couple of the techniques described might work in VBA?!?

HTH + Cheers - Peter
 
S

scorpion53061

Actually Peter you are so right.

I am automating Word from a vb.net application and I keep running into RPC
server errors.

It appears (I may be wrong) that even though i close the document
(ActiveWindow.Close) It will not allow me to add another document using teh
add command in that thread.

I am sorry I was just frustrated about this....more of a jest comment I
guess.
 

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