|
-
Apr 18th, 2006, 10:09 AM
#1
Thread Starter
Lively Member
[RESOLVED] Word document shutting down before printing
I am trying to print a word document, but with the code I have the document gets shut down before it gets a chance to print. I can put a breakpoint in the code and step through it and it will print before I get to the line to .Quit. Any ideas?
Code:
objWdApp.Visible = True
objWdApp.PrintOut
If objWdApp.Options.PrintBackground = True Then
DoEvents
End If
objWdApp.Quit wdDoNotSaveChanges
Application.DisplayAlerts = wdAlertsNone
'frmdistricts.Show
Screen.MousePointer = vbHourglass
Set objwdRange = Nothing
Set objWdDoc = Nothing
Set objWdApp = Nothing
Screen.MousePointer = vbDefault
End If
-
Apr 18th, 2006, 12:52 PM
#2
Thread Starter
Lively Member
Re: Word document shutting down before printing
I found a solution, but now it takes about 2-3 minutes for the word document to spool to the printer and then print. My printer usually responds to a print job w/in seconds. Can anybody tell me if my code is causing this?This is the altered code:
[CODE]
objWdApp.Visible = True
objWdApp.PrintOut
Do Until objWdApp.BackgroundPrintingStatus = 0
DoEvents
Loop
objWdApp.Quit wdDoNotSaveChanges
Application.DisplayAlerts = wdAlertsNone
Screen.MousePointer = vbHourglass
Set objwdRange = Nothing
Set objWdDoc = Nothing
Set objWdApp = Nothing
Screen.MousePointer = vbDefault
-
Apr 19th, 2006, 03:42 PM
#3
Thread Starter
Lively Member
Re: Word document shutting down before printing
Resolved:
Code:
objWdApp.Visible = True
objWdApp.PrintOut
objWdApp.ActiveDocument.PrintOut Background:=False
objWdApp.Quit wdDoNotSaveChanges
Application.DisplayAlerts = wdAlertsNone
End With
Screen.MousePointer = vbHourglass
Set objwdRange = Nothing
Set objWdDoc = Nothing
Set objWdApp = Nothing
Screen.MousePointer = vbDefault
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|