View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Otto Moehrbach Otto Moehrbach is offline
external usenet poster
 
Posts: 1,090
Default Macros - Force execution using workbook_open

You have to go at this by way of the back door. Obviously, a macro will not
do what you want if the user elects to open the file with macros disabled.
What you need to do is to build one sheet that has nothing on it but a
message saying to the user that he must open the file with macros enabled or
he will not be able to use the file.
Then you use a Before_Close event macro that does nothing more than hide
all the sheets except that one sheet with the above message, saves the file
and closes the file.
Then in your Workbook_Open macro, include code to hide the above sheet
and unhide all the others. Actually you must write that code to unhide the
other sheets first, then hide the one sheet. You will get an error if the
code tries to hide all the sheets.
This makes it so that if the user opens the file with macros disabled,
he will see nothing but that one sheet with the message. HTH Otto
"Guy Normandeau" wrote in message
...
I have macros running using the workbook_open functionality. Everything
works great... except when the user selects to disable the macro
functionality. Is there a was to protect my workbook to force this macro
to
run when the user opens it? I know it opens up a can of worms but I do
need
to have this functionality run as soon as the spreadsheet is open.

Thanks in advance

Guy Normandeau