View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default How can I make the print icon trigger customized macro?

Bon-

You could save the macro to your personal workbook. That way it should stay
connected to the print button.

Jayson

"Bon" wrote:

Hello all

How can I make the print icon trigger customized macro?
My idea:
I have a MS Access user interface with buttons. When I clicked the Save
Draft button, the MS Excel workbook will be saved in a folder. Inside
the MS Excel workbook, I created a watermark macro and I assigned the
watermark macro to the Print icon. (Right click the Print icon -
Customize - Right click the print icon - Assign Macro). When the user
clicks the Print icon, the DRAFT watermark will be added to all
worksheets and the print dialog box will be shown.

When I open a new workbook using one of the button in MS Access
interface and click the print icon, the assigned name will be changed.
So, an error "specified object can't be found" occurs. For example, I
assigned the macro (watermark) to the Print button in abc.xls workbook.
If I click the open button in the MS Access interface and click the
Print button, the assigned macro name will be changed to
cde.xls!watermark. The cde.xls is the recently opened workbook.

Can anyone give me some advices?

Thanks
Bon