New Excel Forum

This forum has been moved to TeachExcel.com

Ask all future questions in the New Excel Forum.

ExcelKey

VBA password prompt is coming up when closing excel

Macros, VBA, Excel Automation, etc.

VBA password prompt is coming up when closing excel

Postby DanG » Wed Dec 28, 2011 1:46 pm

I have an extensive file with many userforms and vba functions and subroutines.
It has worked great for years, until now when I am converting to excel 2010.

What is causing the vba password prompt to come up when I try to close the model?
Any help fixing this issue?

I have unloaded all the userforms in the "BeforeClose" routine.

Any ideas are much appreciated.
thanks
  • 0

DanG
Rookie
 
Posts: 2
Joined: Dec 28, 2011
Reputation: 0

Re: VBA password prompt is coming up when closing excel

Postby Don » Wed Dec 28, 2011 6:07 pm

Hi and welcome to the forum!

Do you have the vba password protected normally? Do you have any data queries running? Also, it wouldn't be possible to include it here would it? There seem to be a number of reasons this may happen, but, not having Excel 2010 at the moment, it's difficult to test. Have you tried it in Excel 2007?

You might try this link:

http://support.microsoft.com/kb/280454
  • 0

Don
Moderator
 
Posts: 733
Joined: Dec 4, 2011
Reputation: 2
Excel Version: 2010

Re: VBA password prompt is coming up when closing excel

Postby DanG » Fri Dec 30, 2011 7:00 pm

Hi
Posting is not possible.
This thing has 60 userforms, and a lot of programming being called.
The file worked in the earlier releases of excel.
i have found an approach to making this work.
Basically, in my userforms I allow the user to "STOP" the effort.
As part of this if I program a "Application.quit" then when the user exits excel life is good.

Really as part of my debugging if the user hit the "X" in the upper right corner to close the workbook i didn't get this problem. I only get the problem when I went through the "File-Close" and "File-Exit" menus.

Anyway, programming the "Applicaiton.quit" and followling that with a user "File-Exit" process through the menus seems to fix the problem.

Any insights into the difference between a hit of the "X" in the upper right corner vs. a "File-Close" action through the menu is greatly appreciated.

dan
  • 0

DanG
Rookie
 
Posts: 2
Joined: Dec 28, 2011
Reputation: 0

Re: VBA password prompt is coming up when closing excel

Postby Sisyphus » Fri Dec 30, 2011 10:00 pm

Hi,
The difference should be in the QueryClose constants returned in the CloseMode argument by the QueryClose Event procedure:
vbFormControlMenu = 0 = The user chose the Close command from the Control menu on the form.
vbFormCode = 1 = The Unload statement is invoked from code.

Enjoy 2011 - while it lasts! :D
  • 0

Have a great day! :D

Sisyphus
I do this for "honour and country" - much less of the latter, actually.
If I helped you, award points, plenty of them.
If I bored you, deduct points for being too long-winded. (I know, :lol)
Sisyphus
Former Moderator
 
Posts: 4454
Joined: Dec 7, 2011
Location: Shanghai
Reputation: 203
Excel Version: 2010


Return to Macros and VBA Questions

Who is online

Users browsing this forum: No registered users and 229 guests