Results 1 to 9 of 9

VBA Chart Axis editing

Threaded View

  1. #1
    Registered User
    Join Date
    11-04-2011
    Location
    Linz
    MS-Off Ver
    Office 2010
    Posts
    13

    Question VBA Chart Axis editing

    Hi there,

    I am currently trying to transfer my Excel 2003 scipts to my new PC and Excel 2010. I am having few problems though, one of them is the following:

    It seems to be no longer possible to format an axis title of a graph partly in superscript. What I want to do is to make Excel create a new graph with VBA, and in this process I also want to define the axis titles. One of them should read "unitname / s-1" where the "-1" part should be superscript. In Excel 2003 this worked fine with the following code:

    With ActiveSheet.ChartObjects(i)
    With .Chart
    With .Axes
    .HasTitle = True .AxisTitle.Caption = "unitname / s-1" .AxisTitle.Characters(Start:=13, Length:=2).Font.Superscript = True .AxisTitle.HorizontalAlignment = xlCenter
    End With
    End With
    End With
    (Excuse the excessive use of "With" loops, I have several other things going on there in between as well.)
    This no longer seems to work. What I have found is that if I set the last command to

    .AxisTitle.Characters(Start:=13, Length:=2).Font.Superscript = True
    it leads to the whole word (not just 2 characters!) being superscripted. However, this is not what I am looking for. Has anybody an idea what I could do here?

    Also, the xlCenter command does not lead to any visible result neither.

    Harry



    PS: On a side note, I had to find out that obviously it is no longer ok to define the name of a dataset with something like this:

    ActiveChart.SeriesCollection(1).Name = ActiveSheet.Range("A1:A3")
    In Excel 2010, I can only get this to work with something like that:

    ActiveChart.SeriesCollection(1).Name = ActiveSheet.Range("A1")
    Is there a workaraound?
    Last edited by theDirtyHarry; 11-09-2011 at 10:57 AM. Reason: [SOLVED]

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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