1

I have inserted an ActiveX spreadsheet control into an Excel VBA form.

I have written a procedure in the ThisWorkbook.Workbook_Open() event and it will not execute upon opening the workbook when the ActiveX spreadsheet control exists on the form.

In effort to simplify the problem, I have:

  • Created a new workbook.
  • Added a blank form "UserForm1".
  • Added an ActiveX spreadsheet control to "UserForm1", "Spreadsheet1".
  • In ThisWorkbook, added the Private Workbook_Open() event: The Workbook_Open event does not execute when the workbook is opened. When the spreadsheet control is deleted from the form, the workbook_open event executes normally.

Macros are enabled in both cases. Other macros execute successfully when manually called.

How do I get the workbook_open event to execute with an ActiveX control on a VBA form?

Private Sub Workbook_Open()
    MsgBox "Workbook_Open event has executed."
End Sub

UPDATE: When security is set to "Disable all macros with notification" and file is opened for the first time in protected view, the Workbook_Open() event is fired. On subsequent opening of the file, the event is not fired.

D. Mob
  • 11
  • 5
  • Post the ThisWorkbook.Workbook_Open() event code – MatthewD Oct 15 '15 at 16:14
  • I added some details and the ThisWorkbook.Workbook_Open() event code. I have tried to simplify the problem as much as possible and can't think of any other relevant details. – D. Mob Oct 15 '15 at 16:31
  • I am also interested to know if anyone can duplicate the behavior. – D. Mob Oct 15 '15 at 19:37

0 Answers0