+ Reply to Thread
Results 1 to 8 of 8

What's the best way to execute code on a protected chart?

  1. #1
    Forum Contributor
    Join Date
    05-24-2006
    Location
    Los Angeles
    MS-Off Ver
    2019
    Posts
    328

    What's the best way to execute code on a protected chart?

    Hi,

    I have some code that changes the axis of an embeddes chart when a user pressed a button. Trouble is, that worksheet and the chart are supposed to be password protected and the code will not work on a protected chart...it blows up.

    What is the best way to have the code work and to still have the chart and sheet protected? Do I need to have code unprotect the chart first? Is that a secure thing to do?

    Please Login or Register  to view this content.

    Lawrence
    Last edited by skysurfer; 04-22-2010 at 10:58 AM.

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: What's the best way to execute code on a protected chart?

    See this link on How to run macros on protected sheets
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  3. #3
    Forum Contributor
    Join Date
    05-24-2006
    Location
    Los Angeles
    MS-Off Ver
    2019
    Posts
    328

    Re: What's the best way to execute code on a protected chart?

    Palmetto,

    Thanks. Only problem is Mr. Excel's recommendation to place the security code in the workbook open event didn't work. Suspect it has to do with the embedded chart.

    Please Login or Register  to view this content.
    Or maybe I messed it up?

    Lawrence

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: What's the best way to execute code on a protected chart?

    Did you unlock the charts?
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Forum Contributor
    Join Date
    05-24-2006
    Location
    Los Angeles
    MS-Off Ver
    2019
    Posts
    328

    Re: What's the best way to execute code on a protected chart?

    If the charts are locked, I get an error on opening the file:

    "Compile error in hidden module: ThisWorkbook"

    If I unlock the charts, every macro work perfectly...except that the charts are no longer protected and can be changed/deleted by the user.

    Is there security code that works with charts?

    Lawrence

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: What's the best way to execute code on a protected chart?

    I can't address the compile error -- don't know what's there.

    However, you can always unprotect the sheet in code, do whatever you want, and then reprotect the sheet.

  7. #7
    Forum Contributor
    Join Date
    05-24-2006
    Location
    Los Angeles
    MS-Off Ver
    2019
    Posts
    328

    Re: What's the best way to execute code on a protected chart?

    Yup, that seems to be the sure bet right now. Is there any way to stop or break a macro before it's finished and before the protection is re-engaged? like hitting the escape key or something?

    Lawrence

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: What's the best way to execute code on a protected chart?

    Yes, via the Esc key, or via Ctrl+Break.

    If secure is what you're looking for, Excel is not your animal.

+ 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