+ Reply to Thread
Results 1 to 7 of 7

Chart.Labels.Add function doesn't work in excel 2007

  1. #1
    Registered User
    Join Date
    03-05-2010
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2007
    Posts
    4

    Chart.Labels.Add function doesn't work in excel 2007

    Hi

    I am new to macros. We are using some macros which is running perfectly fine in excel 2003 but in 2007 it is throwing error in following function. So can you please help on this.

    The error comes at line
    Set objLabe2 = cht.Labels.Add(dblXPosition, dblYPosition, intLength, intHeight)

    in following function (this line don't create any error if excel 2003 installed on my machine but if excel 2007 installed then it says unknown exception occured in the system.

    Please Login or Register  to view this content.
    Last edited by narek1; 03-08-2010 at 09:24 AM. Reason: To comply with rule1

  2. #2
    Forum Contributor sauerj's Avatar
    Join Date
    11-11-2009
    Location
    Lafayette, IN
    MS-Off Ver
    Excel 2019
    Posts
    163

    Smile Re: Chart.Labels.Add function doesn't work in excel 2007

    Try changing ...
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    objLabe2 is never declared anywhere, but objLabel is. And, the next line uses objLabel, not objLabe2.

    There seems to be other potential issues. Like ...
    * mdblXmin, mdblXmax and mdblYmin, mdblYmax never get defined (???), and ...
    * ActiveSheet.ChartObjects("cht").Activate ... failed for me. I commented it out; and it worked. I don't think you need it anyway.
    ... Regards, sauerj
    Last edited by Paul; 03-10-2010 at 10:46 PM.

  3. #3
    Registered User
    Join Date
    03-05-2010
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Chart.Labels.Add function doesn't work in excel 2007

    Hi

    Thanks for reply. I am sorry mistakenly I have typed 2 there but it is objLable only and in Debug mode I am getting all the values withoot any problem. Moreoverly it is working without any problem if Excel 2003 installed machines. But now all our machines are installed with Excel 2007. Since then it is theowing error at this place.

    Thanks
    Krishna
    Last edited by teylyn; 03-10-2010 at 06:58 AM. Reason: removed spurious quote

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Chart.Labels.Add function doesn't work in excel 2007

    Krishna, when you are replying to a post directly above, please do not quote. It just creates clutter. Thanks.

  5. #5
    Forum Contributor sauerj's Avatar
    Join Date
    11-11-2009
    Location
    Lafayette, IN
    MS-Off Ver
    Excel 2019
    Posts
    163

    Re: Chart.Labels.Add function doesn't work in excel 2007

    Sorry Kirshna (narek1) ... I'm stumped on this one. Since I use 2003, I can't troubleshoot by using 2007. My guess is that there is an alternate way of doing this in 2007. Hopefully an excel 2007 forum user offers up a solution. Sorry.

  6. #6
    Registered User
    Join Date
    03-05-2010
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Chart.Labels.Add function doesn't work in excel 2007

    Ok no problms

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

    Re: Chart.Labels.Add function doesn't work in excel 2007

    In xl2007 you will need code like this

    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