Seeing if header/footer is open before running a macro

S

SWT

Is there a way in VBA (Word 2003) to find if the user has the header/footer
view open?

If there is, would there then be a way to close it?

Thanks
 
G

George Lee

SWT said:
Is there a way in VBA (Word 2003) to find if the user has the header/footer
view open?
Remember the first attempt should always be to record a macro and see what
code it generates. In this case, the key is
ActiveWindow.ActivePane.View.SeekView. See the WdSeekView values. There’s
several views and you might need several Ifs or combinations to get it as you
need it.
If there is, would there then be a way to close it?
Again, yes, ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument such
as:

If ActiveWindow.ActivePane.View.SeekView <> wdSeekMainDocument then
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
 

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