![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Feb 2002
Location: Kitchener, Canada
Posts: 32
|
I have a sheet that can only be printed if certain cells have been populated using the before_print event.
The problem is I want to print preview without needing to fill in all the required fields. The print event and print preview events are one in the same. How can I run a piece of code to cancel the event of printing but not for print previewing? |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
|
First, take a look at this:
http://www.mrexcel.com/board/viewtop...ic=466&forum=2 Then, you should have a public variable that sets to True (Or False) if the Print button was pressed and the oposite if the Print Preview button was pressed. Then, in the BeforePrint() event do something like If MyVar = True then 'Check for populated cells Else 'Do nothing, allow to print preview End If |
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
|
Also, I don't think this works in Excel 97.
|
|
|
|
|
|
#4 |
|
New Member
Join Date: Feb 2002
Location: Kitchener, Canada
Posts: 32
|
this will allow the user to print preview. When they are in the preview screen they will be allowed to hit the print button there. This is the thing I'm trying to avoid the most.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|