Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Exit File...
Hi...
Is there code that will shutdown an excel file if when prompted the user selects diable macros when entering the file. I want to protect my work from excel pirates! Therefore, when enable macros is selected the file will load as intended? Any help will be greatly appreciated... Gordon... |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Exit File...
Hi Gordon
If the user disable macros no code will run. A good way is to hide all sheets except one and unhide them in the workbook open event. Place a message on that sheet with "you must enabled macro's to work with this file" And hide the sheets in the beforeclose event. So the user can't use the workbook if he disable macro's. If he do the workbook open event don't run so there are no sheets to work with You must also protect your project in the VBA editor because a user can unhide the sheets there also if you don't do that Some example code to do this the first Sheet stay always visible Sub HidealmostAll() Dim a As Integer For a = 2 To Sheets.Count Sheets(a).Visible = xlVeryHidden Next a End Sub Sub ShowAll() Dim a As Integer For a = 2 To Sheets.Count Sheets(a).Visible = True Next a End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Gordon" wrote in message ... Hi... Is there code that will shutdown an excel file if when prompted the user selects diable macros when entering the file. I want to protect my work from excel pirates! Therefore, when enable macros is selected the file will load as intended? Any help will be greatly appreciated... Gordon... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I set up a file to automatically save on exit? | Excel Discussion (Misc queries) | |||
excel save file upon exit | Excel Discussion (Misc queries) | |||
Exit Sub if file/path not found | Excel Programming | |||
Can only exit the program from the file menu | Excel Discussion (Misc queries) | |||
Run a dos batch file as soon as I exit/save the spreadsheet | Excel Programming |