Dear all,
I have an excel file which I want to convert to word.
As the column number is big, the word document doesn't show all information, some of columns are not visible.
I changed manually the orientation to Landscape and I was able to see all data.
Issue VBA the change orientation to landscape not working.
This is my code:
Can you please advice.
Thank you
I have an excel file which I want to convert to word.
As the column number is big, the word document doesn't show all information, some of columns are not visible.
I changed manually the orientation to Landscape and I was able to see all data.
Issue VBA the change orientation to landscape not working.
This is my code:
Code:
Sub PasteToWord()
Dim wdApp As Object
Dim wd As Object
On Error Resume Next
Set wdApp = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Set wdApp = CreateObject("Word.Application")
End If
On Error GoTo 0
Set wd = wdApp.Documents.Add
wdApp.Visible = True
Sheets("Sheet2").UsedRange.Font.Size = 8
Sheets("Sheet2").UsedRange.Copy
wd.Range.Pasteandformat 0
wd.PageSetup.Orientation = wdOrientLandscape
wd.SaveAs ActiveWorkbook.Path & Application.PathSeparator & "Final_Report.docx"
End Sub
Can you please advice.
Thank you