#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default force macro

Is it possible to disable a workbook if the user decides not to enable
macros ?

Obviously if macros are disabled then I can't use macro code :o) but
then the workbook hasn't loaded at that point anyway, or has it ?

Erm? ;O| Well is it possible ?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default force macro

Fiona wrote:

Is it possible to disable a workbook if the user decides not to enable
macros ?

Obviously if macros are disabled then I can't use macro code :o) but
then the workbook hasn't loaded at that point anyway, or has it ?

Erm? ;O| Well is it possible ?


This has been asked a lot of times. Look he

http://groups.google.cl/groups?hl=es...+workbook+hide

Regards,
--
Beto
Reply: Erase between the dot (inclusive) and the @.
Responder: Borra la frase obvia y el punto previo.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default force macro

Fiona,

Usual way is to put a message on one sheet that says that the user must run
with Macros enabled. Hide all the other sheets (use xlVeryHidden so that it
cannot be changed in Excel). In the Workbook_Open event add some code to
hide that sheet, and un hide all others. If they don't enable macros, your
macro won't fire, so they only see the warning sheet.

It isn't foolproof, but it should help.

Oh, by the way, add code in the Before_Close event to unhide the warning
sheet, and very hide the others.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Fiona" wrote in message
om...
Is it possible to disable a workbook if the user decides not to enable
macros ?

Obviously if macros are disabled then I can't use macro code :o) but
then the workbook hasn't loaded at that point anyway, or has it ?

Erm? ;O| Well is it possible ?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default force macro

the workbooks load whether macros are disabled or not. There is no setting
that would change the loading process based on the users response to the
question to disable macros. If he workbook is selected to be opened, it
will be opened particularly if macros are disabled (nothing can act to close
it).

You can put your code in an addin, then the user can elect to load your
addin and will not be prompted each time.

In xl2000 or later, you can certify your code and the user can select you as
a trusted source. Subsequent openings will not prompt.

The popular alternate suggestion is to hide all your sheets with a single
sheet showing with a message that functionality is not avaiable unless the
user chooses to enable macros. Then in the workbook_open event, there is
code to make the workbook functional and in the workbook_beforeclose event
restore it to its single sheet form. With the limited protection afforded
workbooks, this is easily defeated, but may be satisfactory in your
situation.

--
Regards,
Tom Ogilvy

"Fiona" wrote in message
om...
Is it possible to disable a workbook if the user decides not to enable
macros ?

Obviously if macros are disabled then I can't use macro code :o) but
then the workbook hasn't loaded at that point anyway, or has it ?

Erm? ;O| Well is it possible ?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default force macro

Thanks Everyone for the help, Veryhiddensheets then.

Jeff, your option 1) of protecting WB/WS adds a little extra but when
I protect my WB it loads restored rather than maximised, any ideas ?
Sheet protection is OK but if I try to protect the WB too it just
loads restored?


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default force macro

It looks like the window is restored (not maximized) if you select Protect Windows. If you only select Protect Structure the windows work OK. You probably don't want to protect the display windows in this case anyway..

Workbook-level protection only keeps users from changing the order of sheets (structure) or window display. It doesn't affect the data. To protect data, you want Worksheet-level protection.
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
Force Macro BNT1 via OfficeKB.com Excel Discussion (Misc queries) 0 June 18th 09 11:01 AM
Auto force a macro Jase Excel Discussion (Misc queries) 3 October 27th 08 03:12 PM
Force Macro Enable Rob Excel Programming 3 January 30th 04 03:31 PM
how to trigger macro or force autofit lcoreyl Excel Programming 3 October 28th 03 04:27 PM
How to force Workbook's macro unloading? Mauricio Villada Excel Programming 0 September 22nd 03 10:09 PM


All times are GMT +1. The time now is 03:56 PM.

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

About Us

"It's about Microsoft Excel"