+ Reply to Thread
Results 1 to 5 of 5

I am losing my ActiveChart.Name

  1. #1
    Registered User
    Join Date
    04-28-2009
    Location
    Chicago, IL, USA
    MS-Off Ver
    Excel 2007
    Posts
    30

    I am losing my ActiveChart.Name

    Excel 2007

    I'm trying to name the chart in my macro so the next time I run the macro I can delete the old chart. I use:

    Please Login or Register  to view this content.
    And so on, and *right* after this stretch of code runs I can use the immediate window to print it and I get the generic name.

    Print ActiveChart.Name
    StatPack Chart 28
    Any idea why this is happening? There is only one thing I can think of at this point, and that is that when I set up the chart, I pull it back from its own sheet to the current "StatPack" worksheet using this:

    Please Login or Register  to view this content.
    Is it possible that the chart moving out and back has it's name changed?
    Last edited by mattdick; 04-30-2009 at 11:20 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,466

    Re: I am losing my ActiveChart.Name

    If the active chart is a chart object then try this code instead.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    04-28-2009
    Location
    Chicago, IL, USA
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: I am losing my ActiveChart.Name

    Thank you, you forced me to try this again. I'd done it once and had gotten an error (something like "no such object in this context"). As it turns out, I had called "ActiveChart.Parent..." prior to placing the chart back in the worksheet. So when it's a chart on its own tab, apparently there is no parent.

    Or at least this tracks with what I was seeing.

    Thanks again.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,466

    Re: I am losing my ActiveChart.Name

    Technically there is a parent for a chart sheet, it's the workbook.

    In your example "StatPack Chart 28" is the charts name. When dealing with chartobjects you need the ChartObject name, which is when you use the Parent property to find it if using the Activechart object.

  5. #5
    Registered User
    Join Date
    04-28-2009
    Location
    Chicago, IL, USA
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: I am losing my ActiveChart.Name

    I'm not 100% sure I understand the heirarchies, but I think I have the tools to start playing around and understanding will follow.

    Thanks again.

+ 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