Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
PrintPreview
How can a PrintPreview screen be close through VBA code?
Thank you in advance for your help. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
PrintPreview
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. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
PrintPreview
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. |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
PrintPreview
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. |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
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. |
#6
Posted to microsoft.public.excel.misc
|
|||
|
|||
PrintPreview
As I recall those message/dialog boxes have the focus. Until you clear
that, you can't access the window, because it doesn't have focus. In looking at your code, I think you could dispense with "If MsgBox("Close?", vbYesNo) = vbYes Then " and just use SendKeys "{ESC}" Gerry Verschuuren wrote: 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
ActiveX Controls moving upon print/printpreview | Excel Discussion (Misc queries) |