M
MSuserATL
Please HELP!
When I first call the code below in a macro from another spreadsheet, the
execution halts at the ‘SelectedSheets.PrintOut’ line. I have to close down
EXCEL using the Windows task manager. After I clear all instances of EXCEL
from the window task manager, the macros works. It successfully prints the
submitted spreadsheet as long as I continue to execute the macro within 20
minutes of the last execution.
I’m certain that it halts at the ‘SelectedSheets.PrintOut’ line because when
I comment out the PrintOut line the macro runs through with no errors. I’ve
also tried to catch the error at the ‘PrintOut’ line but the system never
throws one. I’ve also tried to change the default printer but the same
results exist.
Sub print_48(fname As String)
' Disable the GUI Alerts
Application.DisplayAlerts = False
Application.EnableEvents = False
Application.AskToUpdateLinks = False
Application.AlertBeforeOverwriting = False
Application.FeatureInstall = msoFeatureInstallNone
Workbooks.Open Filename:=fname, ReadOnly:=True
'Print Sheet
' this line causes an error
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveWindow.Close
End Sub
Your assistance will be greatly appreciated.
When I first call the code below in a macro from another spreadsheet, the
execution halts at the ‘SelectedSheets.PrintOut’ line. I have to close down
EXCEL using the Windows task manager. After I clear all instances of EXCEL
from the window task manager, the macros works. It successfully prints the
submitted spreadsheet as long as I continue to execute the macro within 20
minutes of the last execution.
I’m certain that it halts at the ‘SelectedSheets.PrintOut’ line because when
I comment out the PrintOut line the macro runs through with no errors. I’ve
also tried to catch the error at the ‘PrintOut’ line but the system never
throws one. I’ve also tried to change the default printer but the same
results exist.
Sub print_48(fname As String)
' Disable the GUI Alerts
Application.DisplayAlerts = False
Application.EnableEvents = False
Application.AskToUpdateLinks = False
Application.AlertBeforeOverwriting = False
Application.FeatureInstall = msoFeatureInstallNone
Workbooks.Open Filename:=fname, ReadOnly:=True
'Print Sheet
' this line causes an error
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveWindow.Close
End Sub
Your assistance will be greatly appreciated.