Detecting view state

K

Kamran

I made a toolbar button with a macro to view two pages in print layout view.
When I'm in Normal view I often forget to switch to Print Layout view first,
and the button returns a VB Debug error. What can I add to the macro code to
detect the view state and switch to Print Layout if it's still in Normal?
Thanks for the help.
 
J

Jay Freedman

I made a toolbar button with a macro to view two pages in print layout view.
When I'm in Normal view I often forget to switch to Print Layout view first,
and the button returns a VB Debug error. What can I add to the macro code to
detect the view state and switch to Print Layout if it's still in Normal?
Thanks for the help.

Hi Kamran,

You don't need to detect the view, you just need to insert the command

ActiveWindow.View = wdPrintView

before changing the zoom. If the view was already Print Layout, this
command just won't change anything. If the view was Normal or anything
else except Print Layout, it will change the view.
 

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