Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default how can i run macro when i print worksheet.

..Hi to all

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

tnk in advance

****al
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default how can i run macro when i print worksheet.

****al,

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)


"****al shah" wrote in message
...
.Hi to all

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

this
possible.

tnk in advance

****al



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 303
Default how can i run macro when i print worksheet.

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

"****al shah" wrote in message
...
.Hi to all

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

tnk in advance

****al



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Create Macro to Increase Cell Value to one and Print Worksheet [email protected] Excel Worksheet Functions 4 July 24th 08 08:48 PM
Select Worksheet to print Macro Angel_24477616 Excel Worksheet Functions 0 March 19th 07 12:56 PM
Macro to print a selected range, not entire worksheet James C Excel Discussion (Misc queries) 3 October 19th 05 10:12 PM
print a specific area within a worksheet by clicking on print? honclub Excel Worksheet Functions 1 October 29th 04 03:22 AM
Print Macro that will Print Entire worksheet except.... Ron de Bruin Excel Programming 0 July 1st 04 04:26 PM


All times are GMT +1. The time now is 10:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"