I have the code below in Workbook module:
Private Sub Workbook_Open()
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
Application.DisplayFormulaBar = False
Application.DisplayStatusBar = Not Application.DisplayStatusBar
ActiveWindow.DisplayWorkbookTabs = False
ActiveWindow.DisplayHeadings = False
Application.WindowState = xlMaximized
ActiveSheet.UsedRange.Select
ActiveWindow.Zoom = True
Range("A1").Select
End Sub
But when I open the workbook in question, the settings in the code are also applied to all other workbooks that are opened. How could I limit the settings in the code to apply only to the workbook in question? Best Regards
EDIT: This solution does not work for me either:
Private Sub Workbook_Open()
With Me
Application.WindowState = xlMaximized
ActiveSheet.UsedRange.Select
ActiveWindow.Zoom = True
Range("A1").Select
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
Application.DisplayFormulaBar = False
Application.DisplayStatusBar = Not Application.DisplayStatusBar
ActiveWindow.DisplayWorkbookTabs = False
ActiveWindow.DisplayHeadings = False
End With
End Sub
try this, add a With me
in the line after the Private Sub Workbook_Open()
like this
Private Sub Workbook_Open()
with me
'all the rest of the code
end with
end sub
it worked here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.