View Full Version : Solved: Print Open Files
Anne Troy
08-23-2004, 07:15 AM
Could a macro be written to print all the currently open Word files?
TonyJollans
08-23-2004, 08:05 AM
Something like ..
For each d in Documents
d.printout
next
??
Anne Troy
08-23-2004, 08:10 AM
Sweeeeeeeeeet.
Anne Troy
08-23-2004, 08:11 AM
I ended up with this. Is it correct?
Option Explicit
Sub PrintAll()
Dim d As Document
On Error Exit Sub
For Each d In Documents
d.PrintOut
Next
End Sub
TonyJollans
08-23-2004, 08:19 AM
Looks good. Sorry about the sloppy code :)
Anne Troy
08-23-2004, 08:24 AM
No problem at all, Tony. I just want to make sure.
Do ya want to go ahead and add it to the kb?
:D
TonyJollans
08-23-2004, 08:29 AM
Sure! Just like that? No clever stuff? Consider it done.
:)
lucas
08-23-2004, 05:00 PM
Ann,
I had trouble with the error handler you used when I tried it in Word 2000. The following worked in my old version of Word.
Option Explicit
Sub PrintAll()
Dim d As Document
On Error GoTo ErrorHandler
For Each d In Documents
'uncomment the line that says d.PrintOut to actually print
'and comment or delete the line that says d.PrintPreview
'd.PrintOut
d.PrintPreview
Next
ErrorHandler:
Resume Next
End Sub
It's a good idea, thanks for it.
Anne Troy
08-23-2004, 05:36 PM
Thanks, Steve!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.