Results 1 to 3 of 3

Thread: [RESOLVED] Word document shutting down before printing

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2005
    Location
    North Carolina
    Posts
    102

    Resolved [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

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Sep 2005
    Location
    North Carolina
    Posts
    102

    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

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2005
    Location
    North Carolina
    Posts
    102

    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
  •  



Click Here to Expand Forum to Full Width