Problems with the operation of macros

In my Excel file, there are macros that, when the program starts, set certain window sizes and its position on the screen, as well as completely hide the top menu, and instead of the file name, the desired text is indicated at the top. When compiling a file using XLSPadlock, these macros stop working. The green header remains at the top with some menu items, such as
“File” and “Login”. And the window size is not set. Do you have a solution to this problem?
Here are the macros that stop working because of XLSPadlock:

Sub Auto_Open()
Application.ScreenUpdating = False
Application.WindowState = xlMaximized
Dim AppH, AppW, withCel As Long
ChangeInterface False
withCel = 0
For i = 1 To 20
withCel = withCel + Cells(1, i).Width
Next i
withCel = withCel * 0.9
AppH = Application.Height
AppW = Application.Width
With Application
.ScreenUpdating = False
.WindowState = xlNormal
.Width = withCel
.Height = AppH - 10
.Left = AppW - withCel - 10
.Top = 0
.ScreenUpdating = True
End With
End Sub

Sub ChangeInterface(Value As Boolean)
Application.AutoRecover.Enabled = False
With Application
.ScreenUpdating = False
.Caption = IIf(Value = True, Empty, " text… “)
.DisplayStatusBar = True: .DisplayFormulaBar = Value
With .ActiveWindow
.Caption = IIf(Value = True, .Parent.Name, “”)
.DisplayHeadings = Value: .DisplayGridlines = Value
.DisplayHorizontalScrollBar = True: .DisplayVerticalScrollBar = True
.DisplayWorkbookTabs = Value
End With
.ExecuteExcel4Macro “SHOW.TOOLBAR(”“Ribbon””, " & Value & “)”
.ScreenUpdating = True
End With
End Sub

The problem comes from Auto_Open(). For some unknown reason, Microsoft decided that it is not fired when workbooks are opened with OLE calls (which is the case of XLS Padlock). The workaround is to replace Auto_Open() by the Worbook_Open event method. Can you try if it solves this issue for you?

Thank you. The advice to change Auto_Open() to Worbook_Open helped me solve the problem.

1 Like