Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 211
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I set up a file to automatically save on exit? Brian Excel Discussion (Misc queries) 1 May 15th 10 04:34 PM
excel save file upon exit Sarah Excel Discussion (Misc queries) 2 February 9th 07 06:42 PM
Exit Sub if file/path not found EMoe[_117_] Excel Programming 5 August 16th 06 11:52 PM
Can only exit the program from the file menu Chuck Bowser Excel Discussion (Misc queries) 1 April 11th 06 03:08 PM
Run a dos batch file as soon as I exit/save the spreadsheet Lynda Excel Programming 11 August 5th 05 07:47 AM


All times are GMT +1. The time now is 05:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"