+ Reply to Thread
Results 1 to 8 of 8

Close Excel if macros not enabled

Hybrid View

  1. #1
    Registered User
    Join Date
    07-12-2005
    Posts
    21

    Close Excel if macros not enabled

    Hi,

    I have a Excel spreadsheet, that is used by lots of people and i have a very basic login screen, when the username is entered, the spreadsheet can be ammeded by a userform
    As usual when the spreadsheet is opened Excel asks wether to enable or diable macros.
    Is there any way that if the the user says to diasable the macros, the spreadsheet will not open ?

    I think i already know the answer, but thought i would ask anyway

    Thanks

    Phil

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Phil,

    It's a catch-22. Excel checks for macros before it finishes loading, but you need macros to run the login screen. You could create an Add-In for the login. Provided the user has their security set to trust all Add-Ins and Templates, your Add-In could launch your program.

    Sincerely,
    Leith Ross

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You can't, most ways involve hiding relevant sheets on closing & obviously these will remain hidden until macros are enabled & the code to unhide them runs.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Registered User
    Join Date
    10-06-2003
    Location
    Ashford, Kent - Working in London
    MS-Off Ver
    Office 365
    Posts
    95
    What I do is to have a worksheet which says "You need to enable macros to enable data to be entered...." and then gives instructions on how to do this....click 'Enable macros' or go to 'Tools' > 'Marcos' > 'Security' and set to medium (I'd never encourage someone to set it to low), then close and reopen the workbook.

    I then ensure that...

    1. the file is saved with that screen showing and the 'Data Entry' screen hidden, and...
    2. that an auto_close macro switches to the macro info screen before closing and hides the 'Data Entry' sheet, to ensure that if it's opened with macros disabled that is what the user will see.
    3. install an auto_open macro which hides the macro info sheet and opens the 'Data Entry' sheet IF macros are enabled.

    Make sense? It gets round it for me and informs the user about how what to select or what to do if their macro security level is set at High.

    Hope that helps.

    Chris.
    Big Chris

  5. #5
    Registered User
    Join Date
    10-06-2003
    Location
    Ashford, Kent - Working in London
    MS-Off Ver
    Office 365
    Posts
    95
    Tell you what....I'll stop being lazy and just attach an example....

    Just don't forget to protect the macros or someone could mess it up. Open it with macros disabled and enabled to see the difference.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    07-12-2005
    Posts
    21

    Thumbs up That will do me

    Big Chris,

    Thanks, for the explanation, and a large thanks for the example. This is exactly what i need, however it raises other quetions

    1 How did you hide the tabs ?
    2 How can i gain access to the other work sheets
    3 Can i nick your front sheet :-), and what is your password, as it is password protected

    Once again thanks for all your help

    Phil
    Last edited by philbennison; 07-12-2007 at 06:45 AM.

  7. #7
    Registered User
    Join Date
    10-06-2003
    Location
    Ashford, Kent - Working in London
    MS-Off Ver
    Office 365
    Posts
    95
    No worries Phil - Glad to have helped.

    Re...
    1 How did you hide the tabs ?
    Via Tools > Options > View and uncheck the tab box....alternatively, if you mean how do you make the other worksheets 'veryhidden'? then look at the macro via Visual Basic Editor....it should be pretty clear from the code.

    2 How can i gain access to the other work sheets?....there's only one. You can go to Visual Basis Editor and set the hidden worksheet as 'visible'.

    3 Can i nick your front sheet :-), and what is your password, as it is password protected.
    Sure you can...the password is 'hello'.

    Cheers,

    Chris

  8. #8
    Registered User
    Join Date
    07-12-2005
    Posts
    21

    Thumbs up Thanks

    Big Chris,

    Once again.

    Thanks very much for your helps. Works like a charm :-)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1