I would like to copy some excel data in to a word document using VBA
The excel data is build for print area A3. After creating a word document, I am trying to set up paper size for new word document to A3. It is giving me a run time error
Run time error '5889' Requested PaperSize is not available on the currently selected printer
VBA Code that I am using
Set obj = CreateObject("Word.Application")
obj.Visible = True
Set newobj = obj.Documents.Add
newobj.ActiveWindow.Selection.PageSetup.PaperSize = wdPaperA3
Sheets("Page1").Activate
Range("A1:Q18").Copy
newobj.ActiveWindow.Selection.PasteExcelTable False, False, True
newobj.ActiveWindow.Selection.InsertBreak Type:=7
Tried a different approach that is also giving me the same error
On Error Resume Next
Set wdApp = GetObject(, "Word.Application")
If wdApp Is Nothing Then
Set wdApp = GetObject("", "Word.Application")
End If
With wdApp
.Documents.Add
.Visible = True
End With
With wdApp.Selection
.PageSetup.Orientation = wdOrientPortrait
.PageSetup.PaperSize = wdPaperA3
.PageSetup.MirrorMargins = wdNarrow
.PasteSpecial , Link:=False, DataType:=14, _
DisplayAsIcon:=False
End With
Set wdApp = Nothing