I am missing something simple here. The code works fine until I put it into an add-in and open an excel.
Here are the steps:
(1) I create an application variable on Workbook_Open
(2) App_WorkbookOpen module calls three small pieces of code.
(3) Errors start such as "Object variable or With Block Variable" not set
The issue is that I have With statements such as:
With ActiveWorkbook
WinTag = .ProtectStructure Or .ProtectWindows
End With
I know the issue is in the ActiveWorkbook call.
Do I need to pass a workbook variable to the subs when I call them?
Thanks
Here are the steps:
(1) I create an application variable on Workbook_Open
(2) App_WorkbookOpen module calls three small pieces of code.
(3) Errors start such as "Object variable or With Block Variable" not set
The issue is that I have With statements such as:
With ActiveWorkbook
WinTag = .ProtectStructure Or .ProtectWindows
End With
I know the issue is in the ActiveWorkbook call.
Do I need to pass a workbook variable to the subs when I call them?
Thanks
Code:
Option Explicit
Dim WithEvents App As Application
Private Sub Workbook_Open()
Set App = Application
End Sub
Private Sub App_WorkbookOpen(ByVal Wb As Workbook)
Call AllInternalPasswords
Call unhideAll
Call pasteValues
End Sub