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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stop an Auto_Open macro 2

Status
Not open for further replies.

PBAPaul

Programmer
Aug 3, 2002
140
GB
I have built a workbook in Excel 2000 which has an
extensive database and a list of users authorised to use
the program. The workbook has a user interface that is
started by an Auto_Open macro. This macro has a password
dialogue and failure to enter the password will close the
application.

I am building an installation program for this database
program and I need to add a new user name to the list in
the database program. I need to add the details to a
table of users in the database program.

How can I open the database program, using VBA, without
the Auto_Open macro starting?

Help!
 
A very simple approach might be to check, in the auto_open sub, the application.username, and if it's you, skip out. There are more secure options, of course, but that's a way to start. Or have the workbook that's being opened check (again, in the auto_open sub) whether the workbook with the VBA code that's doing the opening (i.e., your installation workbook) is open. Presumably your users would not have this workbook.
Rob
[flowerface]
 
The following will work without requiring anything "artificial" be done to the target workbook:

Code:
Application.EnableEvents = False
Workbooks.Open "C:\Dirname\TargetWorkbookName.xls"
Application.EnableEvents = True


HTH
Mike
 
Here's another idea

if your workbook is listed in you recently used files list you can open it from there but hold down the shift key while you do

enable macros and switch from design mode/view

RYMB

i thought that option might have disappeared but it's still there!!

happy friday
;-) If a man says something and there are no women there to hear him, is he still wrong? [ponder]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top