Workbook_Open event not running on password protected workbook

Formula11

Active Member
Joined
Mar 1, 2005
Messages
433
Office Version
  1. 365
Platform
  1. Windows
Does anyone know how to run the "Workbook_Open" event on password protected workbook?
The code below as an example does not work.
Also, I cannot run a macro once in the workbook as well, Design Mode is always on and the error message is "Because of security settings, macro have been disabled".

VBA Code:
Option Explicit

Private Sub Workbook_Open()
    MsgBox "Hi"
End Sub
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Check your Trust Center macro settings.

File ->Options ->Trust Center ->Trust Center Settings ->Macro Settings

1593844895232.png
 
Upvote 0
rlv01, yes I have adjusted these settings, even with"Enable all macros".
Still no good.
 
Upvote 0
rlv01, yes I have adjusted these settings, even with"Enable all macros".
Still no good.
Strange. It works on my Excel 2010. I even protected both the sheet and workbook. When I opened the workbook, the message box popped up.
 
Upvote 0
OK thanks for advising. I wonder what the issue is with mine.
 
Upvote 0
An 'old school' workaround is to use the auto_open macro.

VBA Code:
Private Sub auto_open()
    MsgBox "Hi"
End Sub

Place it in a normal code module
 
Upvote 0
Still no good unfortunately.
For some reason, when I put a password on the workbook, the macros don't run.
The "Design Mode" functionality seems to be greyed out automatically. This is with Office 2007.
 

Attachments

  • Screenshot.png
    Screenshot.png
    29.5 KB · Views: 5
Upvote 0
Yes I've tried this as well, but still have issues.
Started from scratch with a new workbook as well.
 
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,453
Members
448,967
Latest member
grijken

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top