+ Reply to Thread
Results 1 to 2 of 2

Weird error when trying to name a chart

  1. #1
    Registered User
    Join Date
    10-07-2010
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    3

    Weird error when trying to name a chart

    Hi everyone,

    I'm stumped: I'm getting an error while trying to name a chart object using the following VBA code:

    Sub Macro1()
    '
    ' Macro1 Macro
    '
    ActiveSheet.Shapes.AddChart.Select
    ActiveChart.Name = "Anything"

    '
    End Sub
    Even if I run this code in a fresh workbook with no other vba code active, I get "runtime error 7: out of memory." The error occurs on line 6,
    when the code tries to apply a name to the chart.


    This code is part of a larget macro I'm workin on, but I have isolated it for ease of diagnoasis. Does anyone know why I'm getting this error?

    Thanks!

    Nolan

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

    Re: Weird error when trying to name a chart

    If it is a chart object the you need to name the parent of the chart.

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

+ 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