Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default PrintOut Problem

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.

Im certain that it halts at the €˜SelectedSheets.PrintOut line because when
I comment out the PrintOut line the macro runs through with no errors. Ive
also tried to catch the error at the €˜PrintOut line but the system never
throws one. Ive 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.




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default PrintOut Problem

You might need to revise the code to:

For Each sh In ActiveWorkbook.ActiveWindow.SelectedSheets
sh.PrintOut
Next



"MSuserATL" wrote:

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.

Im certain that it halts at the €˜SelectedSheets.PrintOut line because when
I comment out the PrintOut line the macro runs through with no errors. Ive
also tried to catch the error at the €˜PrintOut line but the system never
throws one. Ive 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.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
PrintOut problem Filips Benoit[_2_] Excel Programming 0 November 9th 07 10:33 AM
Problem with PrintOut Method Prasad Excel Programming 2 April 4th 07 03:10 PM
Printout Code Problem Jonsson[_15_] Excel Programming 8 April 26th 04 03:21 PM
ActiveSheet.PrintOut - problem Derek T. Excel Programming 3 February 23rd 04 07:36 PM


All times are GMT +1. The time now is 02:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"