Excel file asks for VBA password when trying to close it

Dave L

Board Regular
Joined
Jun 19, 2003
Messages
87
A client is using an Excel file that we created that contains some VBA code. He enables macros when it opens and everything works fine. However, when he tries to close the file, it asks for a VBAProject password. The only Workbook_BeforeClose event is shown below.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Saved = True
End Sub

Saving has been disabled in the workbook and this just tells the workbook to close without asking about saving even if it has been modified.

We have tested this same file in two different versions of Excel and we don't get the message when we close it. Does anyone have an idea of what might cause this?

Thanks,

Dave
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Dave L said:
A client is using an Excel file that we created that contains some VBA code. He enables macros when it opens and everything works fine. However, when he tries to close the file, it asks for a VBAProject password. The only Workbook_BeforeClose event is shown below.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Saved = True
End Sub

Saving has been disabled in the workbook and this just tells the workbook to close without asking about saving even if it has been modified.

We have tested this same file in two different versions of Excel and we don't get the message when we close it. Does anyone have an idea of what might cause this?

Thanks,

Dave

Does it get this with any other workbook that uses Macros?

Perry
 
Upvote 0
pfarmer,

He has some other files from us that are a similar type and they all work fine. That is what has us so puzzled.

Dave
 
Upvote 0
Dave L said:
pfarmer,

He has some other files from us that are a similar type and they all work fine. That is what has us so puzzled.

Dave

To me it sounds like you have an addin located in the sheet.

Does it ask for the password before or after the sheet appears to be closed?

Perry
 
Upvote 0
pfarmer,

I'm not sure if the sheet appears to close before he gets the message. I will have to contact him to find out.

The workbook does use the analysis toolpak addin. Why would an addin cause this behavior?

Thanks,

Dave
 
Upvote 0
Dave L said:
pfarmer,

I'm not sure if the sheet appears to close before he gets the message. I will have to contact him to find out.

The workbook does use the analysis toolpak addin. Why would an addin cause this behavior?

Thanks,

Dave

I doubt that the analysis toolpak would be causing this problem since the user would probably get errors if he was trying to use functions on the sheet that required it. I was thinking along the lines that the sheet was referencing a resource present on your machines which he doesn't have access to.

From reading another post if an addin was causing a problem, something to try is:

remove the password and save the add-in
close Excel
start excel and give the add-in a password and save it
close Excel

Since the analysis toolpak is protected then you can not remove the password.

However maybe one could delete the analysis toolpak, then reinstall it just in case this would simulate the above.

Perry
 
Upvote 0
Did anyone get to the bottom of this, I am having exactly the same problem, I also have code saving the workbook on exit. The other exasperating thing is it doesnt happen on my PC but it does my bosses?
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

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