Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Jan 2003
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Formatting MSGraph from Word macro (Word 2000/XP)

    Hi all,

    I currently have a macro that takes data from a table and sticks it into a ms graph object which seems to work OK.
    My problem is how do I go about formatting the chart?
    I want to change the colours, font etc.. I have found the ms graph object model on MS's website, but I am having problems getting them to work
    i.e

    .Chart.ChartType = xlRadar
    .PlotBy = xlColumns
    .Chart.HasTitle = True
    .Chart.ChartTitle.Text = "Client APIR Chart"

    ' these commands do not work

    .Chart.ChartArea.Font = "Arial" -
    .Chart.ChartArea.Border = False

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Formatting MSGraph from Word macro (Word 2000/XP)

    Font is an object with properties like Name, Size etc.
    Border is also an object with properties like LineStyle, ColorIndex etc.

    Try

    .Chart.ChartArea.Font.Name = "Arial"
    .Chart.ChartArea.Border.LineStyle = xlLineStyleNone

  3. #3
    New Lounger
    Join Date
    Jan 2003
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Formatting MSGraph from Word macro (Word 2000/XP)

    Thanks Hans for that tip, it's got me going.

    Would you know if there is a resource anywhere where I can get the properties for the chart opject?
    I need to set background colours, turn the legend off etc..

    Thanks

    Naz

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Formatting MSGraph from Word macro (Word 2000/XP)

    Althought there are differences, the object model for MSChart is almost entirely the same as that for charts in Excel, so you can use the Object Browser in the Visual Basic Editor for Excel to investigate objects, properties, methods etc. The online help for Excel VBA also contains examples of manipulating charts in code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •