Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2005

Tip: Looking for answers? Try searching our database.

Change All Headers

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Debra Ann - 18 Nov 2005 16:59 GMT
I need a toolbar button to add the word Proprietary to all the headers in a
document.  I will not know how many headers the user has when doing this,
whether they are same as previous or not, etc.

How could I create a loop that would keep going to the next header and
adding it until there are no more headers left?

Thanks
Signature

Debra Ann

Jezebel - 18 Nov 2005 20:57 GMT
Dim pRange         as Word.Range
Dim pIndex            as long

For pIndex = 1 to 3

   on error resume next         Ignore error if document doesn't have this
type of header
   set pRange = ActiveDocument.StoryRanges(Choose(pIndex,
wdFirstPageHeaderStory, wdPrimaryHeaderStory, wdEvenPagesHeaderStory))
   on error goto 0

   Do until pRange is nothing
       ... [ do whatever]
       set pRange = pRange.NextStoryRange        'Get next header of this
type, if any
   Loop

Next

>I need a toolbar button to add the word Proprietary to all the headers in a
> document.  I will not know how many headers the user has when doing this,
[quoted text clipped - 4 lines]
>
> Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.