View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_5_] Dave Peterson[_5_] is offline
external usenet poster
 
Posts: 1,758
Default 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