Thread: PrintPreview
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Gerry Verschuuren Gerry Verschuuren is offline
external usenet poster
 
Posts: 18
Default PrintPreview

The problem seems to be that I use a MsgBox which shows up on the original
sheet and not on the Preview window. This is the code I am trying to run:

Sub Test()
Dim oWS As Worksheet
For Each oWS In Worksheets
oWS.PrintPreview
If MsgBox("Close?", vbYesNo) = vbYes Then SendKeys "{ESC}"
Next oWS
End Sub

"Bob I" wrote:

What about Alt+C ?

Gerry Verschuuren wrote:
No that doesn't do the job

"Bob I" wrote:


maybe Sendkey the Escape key?

Gerry Verschuuren wrote:


How can a PrintPreview screen be close through VBA code?

Thank you in advance for your help.