Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
Hello,
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 |
#2
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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 :-) |
#3
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
Hi, Cindy. Thanks for the remind on providing more info, will do (this is on
Word 2003). I think you're right about the focus on the button. I had the code above in the sub for a command button click so that it would update a formula SUM field, but it wouldn't work. Instead I came up with the idea to assign a "Score" bookmark to the field and just update it directly. Hope that makes sense. Private Sub CommandButton1_Click() ActiveDocument.Variables("var1").Value = 2 ActiveDocument.Bookmarks("Score").Range.Fields.Upd ate End Sub |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Updating Normal style does not update all styles in document | Microsoft Word Help | |||
Automatic template update isn't updating docs | Page Layout | |||
Command to pull insertion point to top of screen? | Microsoft Word Help | |||
The FILE command does not appear at the top of my word screen. | Microsoft Word Help | |||
confirm SQL command after windows update | Mailmerge |