running macros when "Edit Workbook" is not selected and macro does not run

  • I have a xlsm on SharePoint that the user's select and open (often they work in the template first and later save to their PC's if they decide to)..


    so the "Server Read-Only this workbook was opened from a server in read-only mode Edit Workbook" defaults at the top of the of the sheet.


    all the macros work...except one that i added that opens other sheets (for subsquent calculations)...


    Code
    '...
    Worksheets("a").Visible = True    'works
    Worksheets("b").Visible = True    'works
    Worksheets("c").Visible = True    'doesn't work (Error message - but i do see the tab name, when i stop the code (debug) and right click on a worksheets tab (right click and i can manually unhide
    '...


    i'm not sure what the cause may be (when I enable, all the macros work)...?


    thank you.

  • Re: running macros when "Edit Workbook" is not selected and macro does not run


    You need to make sure that the sheet names in your code match the sheet names (on the tabs) exactly. Check for spaces after the names etc. You could also use the indexes of the sheets instead i.e.

    Code
    Sheet1.visible = xlSheetVisible

    which doesn't rely on the sheet names.
    Otherwise, you'll need to post exactly what the error is for more help.
    Dan

    [SIZE=1]It's like asking a mechanic to fix your car, without actually taking your car to him. Post your code/file and you'll get much quicker and more accurate solutions to your problem.[/SIZE]

  • Re: running macros when "Edit Workbook" is not selected and macro does not run


    Thank you...


    i agree with your point and doubled checked, but i don't think this is the case here... I changed to:


    Code
    Sheet27.Visible = xlSheetVisible


    and it still errored out (i.e., when the "Security Warning Some actie content has been disabled. Click for more details. Enable Content" and I chose not to click and Enable. When I do Enable, the code works...)?


    thank you.


    n.b., this is the only code that doesn't work when not Enabled.

  • Re: running macros when "Edit Workbook" is not selected and macro does not run


    Quote from mjschukas;718879


    and it still errored out (i.e., when the "Security Warning Some actie content has been disabled. Click for more details. Enable Content" and I chose not to click and Enable. When I do Enable, the code works...)?


    This is a security setting issue in Excel. You can make the directory that the file is stored in a "Trusted Location" in your security settings, and it should enable the content for you..


    Dan

    [SIZE=1]It's like asking a mechanic to fix your car, without actually taking your car to him. Post your code/file and you'll get much quicker and more accurate solutions to your problem.[/SIZE]

  • Re: running macros when "Edit Workbook" is not selected and macro does not run


    thank you.


    well, i'm still curious why these won't open and other do...but


    here's what i read when i open from SharePoint: "Server Read-Only This workbook was opened from a servr in read-only
    mode. Edit Workbook"


    can i use VBA to make this SharePoint site a "Trusted Location" ?


    thank you.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!