![]() |
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... |
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... |
All times are GMT +1. The time now is 05:40 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com