Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Print From Macro Only
I want to restrict the users from using the file/print and only be able to
print from a macro. I saw this somewhere where you disable the print before and only allow the user to print from a macro. I can not find it. It went something like setting a global varible I think. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Print From Macro Only
There is a BeforePrint event where you can test a global variable which you
set in code Private Sub Workbook_BeforePrint(Cancel As Boolean) If Not fFromCode Then Cancel = True fFromCode = False End If End Sub 'This is workbook event code. 'To input this code, right click on the Excel icon on the worksheet '(or next to the File menu if you maximise your workbooks), 'select View Code from the menu, and paste the code -- HTH RP (remove nothere from the email address if mailing direct) "Pete" wrote in message ... I want to restrict the users from using the file/print and only be able to print from a macro. I saw this somewhere where you disable the print before and only allow the user to print from a macro. I can not find it. It went something like setting a global varible I think. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Print From Macro Only
Small error
Private Sub Workbook_BeforePrint(Cancel As Boolean) If Not fFromCode Then Cancel = True End If fFromCode = False End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Bob Phillips" wrote in message ... There is a BeforePrint event where you can test a global variable which you set in code Private Sub Workbook_BeforePrint(Cancel As Boolean) If Not fFromCode Then Cancel = True fFromCode = False End If End Sub 'This is workbook event code. 'To input this code, right click on the Excel icon on the worksheet '(or next to the File menu if you maximise your workbooks), 'select View Code from the menu, and paste the code -- HTH RP (remove nothere from the email address if mailing direct) "Pete" wrote in message ... I want to restrict the users from using the file/print and only be able to print from a macro. I saw this somewhere where you disable the print before and only allow the user to print from a macro. I can not find it. It went something like setting a global varible I think. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Print From Macro Only
Hi Pete
Place the following code in the "ThisWorkBook" module.... Private Sub Workbook_BeforePrint(Cancel As Boolean) MsgBox "Please use the 'PrintActiveSheet' macro" Cancel = True End Sub Place the following code in a general module.... Sub PrintActiveSheet() Application.EnableEvents = False ActiveSheet.PrintOut Application.EnableEvents = True End Sub To print the active sheet run the "PrintActiveSheet" macro. -- ----- XL2003 Regards William "Pete" wrote in message ... I want to restrict the users from using the file/print and only be able to print from a macro. I saw this somewhere where you disable the print before and only allow the user to print from a macro. I can not find it. It went something like setting a global varible I think. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Print From Macro Only
Bob...
What version of Excel is that event first introduced? "Bob Phillips" wrote: There is a BeforePrint event where you can test a global variable which you set in code Private Sub Workbook_BeforePrint(Cancel As Boolean) If Not fFromCode Then Cancel = True fFromCode = False End If End Sub 'This is workbook event code. 'To input this code, right click on the Excel icon on the worksheet '(or next to the File menu if you maximise your workbooks), 'select View Code from the menu, and paste the code -- HTH RP (remove nothere from the email address if mailing direct) "Pete" wrote in message ... I want to restrict the users from using the file/print and only be able to print from a macro. I saw this somewhere where you disable the print before and only allow the user to print from a macro. I can not find it. It went something like setting a global varible I think. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Print From Macro Only
xl97.
Jim Thomlinson wrote: Bob... What version of Excel is that event first introduced? "Bob Phillips" wrote: There is a BeforePrint event where you can test a global variable which you set in code Private Sub Workbook_BeforePrint(Cancel As Boolean) If Not fFromCode Then Cancel = True fFromCode = False End If End Sub 'This is workbook event code. 'To input this code, right click on the Excel icon on the worksheet '(or next to the File menu if you maximise your workbooks), 'select View Code from the menu, and paste the code -- HTH RP (remove nothere from the email address if mailing direct) "Pete" wrote in message ... I want to restrict the users from using the file/print and only be able to print from a macro. I saw this somewhere where you disable the print before and only allow the user to print from a macro. I can not find it. It went something like setting a global varible I think. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
print button macro & specific tabs to print | Excel Worksheet Functions | |||
Pivot Table macro to set print area and print details of drill down data | Excel Discussion (Misc queries) | |||
Macro to open print window and set to print entire workbook | Excel Discussion (Misc queries) | |||
Create a print macro that would automatically select print area? | Excel Worksheet Functions | |||
Need Help w/ Print Macro to Print All Visible Sheets (including Charts) in a Workbook | Excel Programming |