Closed Thread
Results 1 to 7 of 7

Saving just as macro-enabled Workbook possible?

  1. #1
    Registered User
    Join Date
    03-15-2011
    Location
    Bangkok
    MS-Off Ver
    Excel 2007
    Posts
    22

    Saving just as macro-enabled Workbook possible?

    Hello everyone,

    because the file is sent to a lot of different persons, my boss wanted my to protect it and shut down the ribbons, formula bar...so it looks similar on every pc.
    I used 'Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"' and a few more.
    Now my problem:
    Most people save it as macro-free workbook, so if they start it again, all the macros are disabled.
    Is there any possibility to allow just saving as a marco enabled workbook?

    Thanks in advance,

    the Intern

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2003
    Location
    British Columbia , Canada
    MS-Off Ver
    03,07,10,13
    Posts
    727

    Re: Saving just as macro-enabled Workbook possible?

    In the VBEditor there is a "ThisWorkBook" object. If you dbl click this object you will be in it's module. The "ThisWorkBook" module has a drop down of event triggers macro stubs. You will want to use code in the "OnOpen", "BeforeClose" and the Save event.

    BeforeClose Macro: Use to hide all sheet except one that tell users that Macros must be enabled.

    OnOpen Macro: You reverse the "beforeClose" process by showing all sheets and hiding the "macro mustbe enabled" warning sheet.

    Now.... if user opens book without macros enabled the OnOpen does not run and so the user only sees the "warning sheet"

    "Save" event Macro is where you test to see what file extention the user is saving file with... if it's anything but xls or xlsb you stop the Save and give user a message that they can't do that.

  3. #3
    Registered User
    Join Date
    03-15-2011
    Location
    Bangkok
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Saving just as macro-enabled Workbook possible?

    Thanks for your quick reply!
    Especially the third paragraph sounds really interisting. How can I:

    Quote Originally Posted by nimrod View Post
    . if it's anything but xls or xlsb you stop the Save and give user a message that they can't do that.
    Thanks again,

    the Intern

  4. #4
    Registered User
    Join Date
    03-15-2011
    Location
    Bangkok
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Saving just as macro-enabled Workbook possible?

    mmh, not really ;-)
    I kind of solved it like that:
    Please Login or Register  to view this content.
    now I just need the macro to start everytime the file is updated...any ideas how I can do this?

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Saving just as macro-enabled Workbook possible?

    I can't se how your code does anything but pastespecial values from sheet1 to sheet2. Which has nothing to do with your Thread Title.

    Also, it won't work if macros are disabled.

    To be honest messing about with users' Excel settings such as hiding the Ribbon should not be lightly undertaken. If anything goes wrong you need to be able to restore those settings, could you?
    Hope that helps.

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

    Free DataBaseForm example

  6. #6
    Registered User
    Join Date
    03-15-2011
    Location
    Bangkok
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Saving just as macro-enabled Workbook possible?

    Sorry,
    this was the wrong thread, I wanted to post it somewhere else^^
    Your right, but the file should have a similar design and disable the users ability to change anything...

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Saving just as macro-enabled Workbook possible?

    This thread is going nowhere, with wrong postings etc. I'm closing it so you can start again, with a better explanation of your problem.

Closed 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