Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Resuming code after closing a print preview
Hello all,
I am using the following code in to call a print preview from a userform Private Sub JobPrint() Me.Hide ThisWorkbook.Sheets("PSheet").PrintPreview Me.Show End Sub When I click on the print button on my userform a sub "builds" a worksheet that contains all the information I want to print. The sub then hides the userform and calls a print preview of the worksheet. When I close the print preview (by clicking the Close button) and Excel shows the userform again, it doesn't return to the print sub from which it was called, so the print sub which called the print preview does'nt complete its execution. Any ideas or help would be great. Thanks in advance. DarrenW |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Resuming code after closing a print preview
Darren,
(Modeless userforms were introduced with Excel 2000, so this advice may not apply to you if you are using an earlier version.) Me.Show opens the userform modally - that is, it requires the user to acknowledge or dismiss the dialog before code execution continues. Me.Show is equivalent to Me.Show vbModal Either use Me.Show vbModeless, which may allow code execution to continue, or open the form later, after the print code finishes. Bob Kilmer "DarrenW" wrote in message m... Hello all, I am using the following code in to call a print preview from a userform Private Sub JobPrint() Me.Hide ThisWorkbook.Sheets("PSheet").PrintPreview Me.Show End Sub When I click on the print button on my userform a sub "builds" a worksheet that contains all the information I want to print. The sub then hides the userform and calls a print preview of the worksheet. When I close the print preview (by clicking the Close button) and Excel shows the userform again, it doesn't return to the print sub from which it was called, so the print sub which called the print preview does'nt complete its execution. Any ideas or help would be great. Thanks in advance. DarrenW |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
First page of Excel sheerepeats in print layout or print preview | Excel Discussion (Misc queries) | |||
Print and Print Preview Graphic Moving Resizing 2007/2003 | Excel Discussion (Misc queries) | |||
print preview v page break preview | Excel Discussion (Misc queries) | |||
cell borders that I create dont show on print preview or print | Excel Discussion (Misc queries) | |||
Closing the VBA Editor using code | Excel Worksheet Functions |