ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro assigned to print command button (https://www.excelbanter.com/excel-programming/373462-macro-assigned-print-command-button.html)

jatman

macro assigned to print command button
 
i have assigned a macro to the print command, (filename is file1.) if i open
another excel spreadsheet (book1 or filename2,) the macro is still assigned
to the print button.

can the print button be reset to set the default command (print)after the
macro has been executed?

jat jaswal

JLGWhiz

macro assigned to print command button
 
If ActiveSheet.FileName = C:\MyDocuments\file1 Then
MyMacro ' Whatever your macro does
Else
Exit Sub
End If



"jatman" wrote:

i have assigned a macro to the print command, (filename is file1.) if i open
another excel spreadsheet (book1 or filename2,) the macro is still assigned
to the print button.

can the print button be reset to set the default command (print)after the
macro has been executed?

jat jaswal


JLGWhiz

macro assigned to print command button
 
If you want the active sheet to print, then change the Exit Sub to
ActiveSheet.PrintOut

I'm wondering why you would tie another macro to the print button. Does it
restrict the printing or specify a particular printer?

"jatman" wrote:

i have assigned a macro to the print command, (filename is file1.) if i open
another excel spreadsheet (book1 or filename2,) the macro is still assigned
to the print button.

can the print button be reset to set the default command (print)after the
macro has been executed?

jat jaswal


jatman

macro assigned to print command button
 
it's used to restrict the printing. i want the macro to work from the print
button on a purchase order (instead of a big ugly command button in the
middle of the screen.) by doing it like this, when they print the purchase
order, it does everything (prints, saves, emails, rolls the count sequence on
the po #.)

i'll try this next week.

thank you
jatman


"JLGWhiz" wrote:

If you want the active sheet to print, then change the Exit Sub to
ActiveSheet.PrintOut

I'm wondering why you would tie another macro to the print button. Does it
restrict the printing or specify a particular printer?

"jatman" wrote:

i have assigned a macro to the print command, (filename is file1.) if i open
another excel spreadsheet (book1 or filename2,) the macro is still assigned
to the print button.

can the print button be reset to set the default command (print)after the
macro has been executed?

jat jaswal



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com