Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calling BeforePrint from any workbook

Status
Not open for further replies.

PeggyC

Programmer
Apr 4, 2002
15
US
Hello,

I'm using Excel 2003. I've created a personal.xls file to run every time Excel is opened. In personal.xls I have a macro that I want to run whenever someone hits the Print button in any workbook. I'm trying to change the printer that Excel will print to (but not the default printer of the computer).

This is in ThisWorkbook of personal.xls :
Sub Workbook_BeforePrint(Cancel As Boolean)
MsgBox "This is working!!" 'test to see if this runs
Application.activeprinter = "bsmt on Ne00:"
End Sub

The macro works but when I go to File-print in any other excel workbook it doesn't work. How do I get this to work for any Workbook that I open and not just personal.xls?

Thanks,
Peggy
 
You might try posting this in the Office forum (forum68) or the VBA forum (forum707). This forum is for VB5/6 issues. Read faq222-2244 to get guidance on forum usage.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top