Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 280
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
First page of Excel sheerepeats in print layout or print preview philfrotonda Excel Discussion (Misc queries) 1 July 12th 07 09:28 PM
Print and Print Preview Graphic Moving Resizing 2007/2003 Adam Rayburn Excel Discussion (Misc queries) 0 April 4th 07 04:18 PM
print preview v page break preview SamB Excel Discussion (Misc queries) 0 November 16th 06 05:09 PM
cell borders that I create dont show on print preview or print scott3435 Excel Discussion (Misc queries) 2 April 6th 06 02:37 AM
Closing the VBA Editor using code Bony_Pony Excel Worksheet Functions 1 March 7th 05 08:14 PM


All times are GMT +1. The time now is 12:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"