Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run Auto Open macro in Excel

Status
Not open for further replies.

Joylaw20

Instructor
Nov 2, 2000
19
0
0
CA
I am not a VBA expert but I have been asked to make some minor adjustments to an existing Excel file. The file is sent to customers and there is no control as to what level their security is set to. The file has an auto_open macro and my question is whether there is a way to force the file to display a message and close if the auto_open macro doesn't run. Any other suggestions for work-arounds?

Thanks,
Joyce
 
If the security setting on the user's computer disables macros, then there's no way to show a dialog.

The best workaround I can think of (and I'm no Excel guru, btw) is to have the document saved protected and set to open to a blank worksheet that shows the message that you want to give the user. Lock the user out of the rest of the document. Then in the auto_open macro, unprotect the document and lock them out of the message worksheet. For full protection, you need to reset the document into the protected mode whenever the document saves.
 
Create a new guide worksheet in excel and write some text about you must enable macros

On the workbook_beforeclose event set all sheets to XlVeryHidden and set the guide sheet created above to xlsheetvisible

On the workbook_open event do the opposite macros are not enabled the guide sheet only is visible
 
Both excellent suggestions! Thanks so much.
Joyce
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top