macro effect on browse control button

S

Steve Paul

I have created a macro that runs through the sections of a document and adds
a footer to each page. A side effect has been that the "browse" control that
is located just below the vertical scroll bar changes from "previous page /
next page" to "previous section / next section". This is a minor annoyance
for users since they can change it back again, but I am wondering if there is
any way to reset this programmatically to its default, since it does not
appear to be a customizable option that can be set anywhere in Word - tools -
options

thanks,
 
J

Jay Freedman

I have created a macro that runs through the sections of a document and adds
a footer to each page. A side effect has been that the "browse" control that
is located just below the vertical scroll bar changes from "previous page /
next page" to "previous section / next section". This is a minor annoyance
for users since they can change it back again, but I am wondering if there is
any way to reset this programmatically to its default, since it does not
appear to be a customizable option that can be set anywhere in Word - tools -
options

thanks,

Yes, this line will reset the browser to previous/next page:

Application.Browser.Target = wdBrowsePage

However, the fact that your macro changes the browser target in the
first place means that you're moving the Selection to the footer pane
of each section. That isn't a good way to work. Your macro would do
better to do something like

Dim oSec As Section
For Each oSec In ActiveDocument.Sections
With oSec.Footers(wdHeaderFooterPrimary)
.Range.Text = "my footer text"
End With
Next oSec

This can get fancier if necessary, but it'll be quicker and less
error-prone than dealing with the Selection.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 
S

Steve Paul

Thank you - that is very helpful
--
Steve Paul


Jay Freedman said:
Yes, this line will reset the browser to previous/next page:

Application.Browser.Target = wdBrowsePage

However, the fact that your macro changes the browser target in the
first place means that you're moving the Selection to the footer pane
of each section. That isn't a good way to work. Your macro would do
better to do something like

Dim oSec As Section
For Each oSec In ActiveDocument.Sections
With oSec.Footers(wdHeaderFooterPrimary)
.Range.Text = "my footer text"
End With
Next oSec

This can get fancier if necessary, but it'll be quicker and less
error-prone than dealing with the Selection.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 

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