I have a macro written in Word that pastes excel data from the clipboard and prints, then closes the app. I want it to wait while Word print before the Word application closes. I need someone to help me figure out whats wrong with my macro. Thanks
Code:
Private Sub Document_Open()
Selection.PasteExcelTable False, False, False
Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
If Application.BackgroundPrintingStatus > 0 Then
While Application.BackgroundPrintingStatus
DoEvents
Wend
Else
Application.Quit SaveChanges:=False
End If
End Sub