Try this workbook. I pasted slightly modified code from my other workbook into your workbook.
BlankSampleWorkbook(1).xls
My warning was that if you don't put some code like what I've included in the example workbook to remove the OnAction assignment when you either close this workbook or switch to another workbook then your print button will still run the macro it was reassigned to point to instead of the default Excel print command.
These two pieces of code are the ones that take care of that.
The first reassign the OnAction property of the print button.
The second resets the OnAction property of the print button to the Excel default.
The workbook I attached then calls the appropriate one of these when the workbook is activated or deactivated from a Workbook Event handler in the ThisWorkbook module.
Sub ReassignOnAction()
Dim i As Integer
i = 1
Do Until Left(Application.CommandBars("Standard").Controls(i).Caption, 7) = "Print ("
i = i + 1
Loop
Application.CommandBars("Standard").Controls(i).OnAction = "PrintSelected"
End Sub
Sub ResetOnAction()
Dim i As Integer
i = 1
Do Until Left(Application.CommandBars("Standard").Controls(i).Caption, 7) = "Print ("
i = i + 1
Loop
Application.CommandBars("Standard").Controls(i).OnAction = ""
End Sub
Hope this helps solve your problem and answers your question.
Bookmarks