View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default 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.