Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Good morning; I am using Windows 2000 and Excel 2000.
I have the following macro for a read only file. The Workbook file contains two worksheets. I need to prevent users from printing either sheet since they are extremely large, (2,000 pages). The macro is being executed but the file still prints. What am I missing here? Thanks Phil If ActiveWindow.SelectedSheets.PrintOut = True Then MsgBox ("This File Is over 1,900 Pages and Too Large to Print") ActiveWorkbook.Close End If End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
By the time your code tries to execute, the print has long since spooled off
to the queue. By then it's too late to intercept. Are you using the BeforePrint event to capture the Print attempt? That's the appropriate place to do so. Insert the line Cancel = True to abort prints BEFORE they get to the queue. In addition, I *think* there's a way to prevent sheets from being printed as an option, but I may be wrong. Randall Arnold "Phil" wrote in message ... Good morning; I am using Windows 2000 and Excel 2000. I have the following macro for a read only file. The Workbook file contains two worksheets. I need to prevent users from printing either sheet since they are extremely large, (2,000 pages). The macro is being executed but the file still prints. What am I missing here? Thanks Phil If ActiveWindow.SelectedSheets.PrintOut = True Then MsgBox ("This File Is over 1,900 Pages and Too Large to Print") ActiveWorkbook.Close End If End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you don't want to use VBA
(user can open the file without macro's also) You can also set the print range on each sheet to a1:a3 or so. Then when they hit the print button only this cells are printed. -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "Randall Arnold" wrote in message ... By the time your code tries to execute, the print has long since spooled off to the queue. By then it's too late to intercept. Are you using the BeforePrint event to capture the Print attempt? That's the appropriate place to do so. Insert the line Cancel = True to abort prints BEFORE they get to the queue. In addition, I *think* there's a way to prevent sheets from being printed as an option, but I may be wrong. Randall Arnold "Phil" wrote in message ... Good morning; I am using Windows 2000 and Excel 2000. I have the following macro for a read only file. The Workbook file contains two worksheets. I need to prevent users from printing either sheet since they are extremely large, (2,000 pages). The macro is being executed but the file still prints. What am I missing here? Thanks Phil If ActiveWindow.SelectedSheets.PrintOut = True Then MsgBox ("This File Is over 1,900 Pages and Too Large to Print") ActiveWorkbook.Close End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to Close a specific workbook. | Excel Discussion (Misc queries) | |||
Macro to close workbook with prompt | Excel Worksheet Functions | |||
How do I print a workbook in but only print selected worksheets? | Excel Discussion (Misc queries) | |||
Macro to include Close Print Preview | Charts and Charting in Excel | |||
run macro on workbook close | Excel Discussion (Misc queries) |