Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2008

Tip: Looking for answers? Try searching our database.

PrintOut Problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MSuserATL - 27 Mar 2008 19:28 GMT
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.
JLGWhiz - 28 Mar 2008 00:50 GMT
You might need to revise the code to:

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

> Please HELP!
>
[quoted text clipped - 31 lines]
>
> Your assistance will be greatly appreciated.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.