Preamble: Workbook with 3 sheets and the following code in it
Private Sub Workbook_Open()
ThisWorkbook.Worksheets("Sheet2").Select
ActiveSheet.Range("A1").Select
ActiveCell = "this text should be in the second sheet cell a1"
ActiveWindow.Zoom = (Application.UsableWidth / Range("a11").Width) * 100
Application.DisplayFullScreen = True
End Sub
The code works fine when opened directly. If the workbook is opend via automation (say with VB), it will "run" but nothing really works the same.
Opened in VB as simple as possible:
Set mobjExcel = CreateObject("Excel.Application")
File = "c:OnOpen_sample.xls"
mobjExcel.Workbooks.Open File, 0, False, , , , True
This is driving me nuts...
Private Sub Workbook_Open()
ThisWorkbook.Worksheets("Sheet2").Select
ActiveSheet.Range("A1").Select
ActiveCell = "this text should be in the second sheet cell a1"
ActiveWindow.Zoom = (Application.UsableWidth / Range("a11").Width) * 100
Application.DisplayFullScreen = True
End Sub
The code works fine when opened directly. If the workbook is opend via automation (say with VB), it will "run" but nothing really works the same.
Opened in VB as simple as possible:
Set mobjExcel = CreateObject("Excel.Application")
File = "c:OnOpen_sample.xls"
mobjExcel.Workbooks.Open File, 0, False, , , , True
This is driving me nuts...