2
votes

I have an file with VBA macro that starts when the Workbook is opening by user. One of the users added Protection Login password to this file, and now the Workbook_open() doesn't react anymore.

It is

Any Ideas?

2
What is the code in the workbook open event?Reafidy

2 Answers

2
votes

Seeing the full code as per Reafidy's comment would help

It sounds like the user is still running code if they have looked to modify it. But it is possible that this user (or other users in the future) may chose to disable macros, or corporate policy may automatically disable macros

If it's user choice then a standard technique is to hide all the worksheets except an splashscreen informing the user that they need to enable macros. If they have enabled macros then all the VeryHidden sheets (cannot be revealed by the standard menu) are made visible and the splashscreen is hidden when the workbook opens

You could combine Brad's splash screen code with your existing Open code

0
votes

There are a couple of options listed from this website

Try using the additional password parameter like this:

Sub OpenBookTest()
Dim myFile As String
Dim myPath As String
myPath = "C:\My Documents"
myFile = "My Workbook.xls"
Workbooks.Open myPath & "\" & myFile, password:="password"
End Sub

Or written another way:

Workbooks.Open "Full Path Name", Password: ="XYZ"

After looking through MSDN, I'm guessing that your Workbook_Open is a custom sub routine that you wrote (or copied from somewhere online). If that is the case then you will need to edit it to allow an additional password parameter. You should edit your question and post your Workbook_Open routine. That way we will know how to help you.