dbowlds
07-01-2018, 04:14 PM
Hello, I have a Word VBA which creates an Excel spreadsheet.
However, I cannot for the life of me figure out how to make the workbook display maximized and also change to page layout view.
Instead, it shows up as a small window, and in Normal view.
I have tried everything I can think of, and have Googled, and all the code I find indicates that what I have should work, but it doesn't.
Can anyone please help me? What I thought should be simple has become quite frustrating.
Private Sub ExcelMax()
Dim ExcelApp As Object, ExcelWB As Object, ExcelWS As Object
Dim StrOut As String
Set ExcelApp = CreateObject("Excel.Application")
ExcelApp.Visible = False
Set ExcelWB = ExcelApp.Workbooks.Add
ExcelApp.Visible = True
Set ExcelWS = ExcelWB.Sheets(1)
ExcelWB.Activate
Application.WindowState = xlMaximized
ActiveWindow.View = xlPageLayoutView
End Sub
Sincerely,
Doug
However, I cannot for the life of me figure out how to make the workbook display maximized and also change to page layout view.
Instead, it shows up as a small window, and in Normal view.
I have tried everything I can think of, and have Googled, and all the code I find indicates that what I have should work, but it doesn't.
Can anyone please help me? What I thought should be simple has become quite frustrating.
Private Sub ExcelMax()
Dim ExcelApp As Object, ExcelWB As Object, ExcelWS As Object
Dim StrOut As String
Set ExcelApp = CreateObject("Excel.Application")
ExcelApp.Visible = False
Set ExcelWB = ExcelApp.Workbooks.Add
ExcelApp.Visible = True
Set ExcelWS = ExcelWB.Sheets(1)
ExcelWB.Activate
Application.WindowState = xlMaximized
ActiveWindow.View = xlPageLayoutView
End Sub
Sincerely,
Doug