how can i run macro when i print worksheet.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

..Hi to all

When i give print command from file menu than only macro has to run. is this
possible.

tnk in advance

Shital
 
Shital,

There is a BefdorPrint event availoable which you could add your code to. Go
to the ThisWorkbook code module, select ThisWorkbook from the left dropdown,
and you will find the event in the right dropdown.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Go to VBA editor using <alt> + <f11>

In the "project - vba project window" double click on "this workbook"
On the right side of the window click on dropdown arrow next to "general"
select "workbook"
click on dropdown arrow next to "open"
select "Beforeprint

enter the name of the macro you want to run without the Sub and without the
( )

So it should look like...........

Private Sub Workbook_BeforePrint(Cancel As Boolean)
macroname
End Sub


Regards
Bill K
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top