View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Basie[_2_] Basie[_2_] is offline
external usenet poster
 
Posts: 3
Default Disabling macros with Shift+[OPEN]

I do it as follows:

Name a cell in worksheet "X" as (say) AutoOpenExecuted.
Add a Workbook_Open procedure (you probably have one
already) and, at the end of it, insert

Sheets("X").Range("AutoOpenExecuted").Value = True

Also add a Workbook_BeforeSave procedure and include in it:

Sheets("X").Range("AutoOpenExecuted").value = False

In a frequently-used procedure, such as one you call at
the beginning of other procedures to perform housekeeping
tasks, or the Class_Initialize procedure for a frequently-
used class, insert:

If Sheets("X").Range("AutOpenExecuted") = False then _
MsgBox "Don't hold shift key when opening workbook"
Thisworkbook.Close SaveChanges:=False

The trick is to find the right place (or places) to check
if the cell is True or False.


-----Original Message-----
Is there a way to prevent a user from disabling VBA

macros
by holding SHIFT when clicking the OPEN button?
I'm using Excel 2000.

Thanks,

Brian.
.