View Single Post
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Cindy M. Cindy M. is offline
external usenet poster
 
Posts: 2,416
Default Updating fields using screen update doesn't work with command butt

Hi Kamran,

The code below works perfectly when tabbing away from a form entry field
that runs the macro on exit, but breaks on the second line when activated in
a Private Sub from a command button -- why?

Application.ScreenUpdating = False
ActiveDocument.PrintPreview
ActiveDocument.ClosePrintPreview
Application.ScreenUpdating = True

I'm not sure I'm following the "activated in a Private Sub from a command
button" part - I'm not sure I understand what all is involved. Best guess:

The "command button" is an ActiveX control from the Controls Toolbox. When it's
clicked, the focus is on the button. Possibly, due to this, Word can't change
the view to Print Preview.

As you've posted this in an end-user group, you might want to pursue in a
word.programming newsgroup, instead. You're more likely to find a broad range
of people with some experience in the question. When you post a question, don't
forget to mention the *version* of the software involved!

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)