Article ID: 190239
Article Last Modified on 1/23/2007
Sub EditDocChart()
Dim Mychart As Object
' Activate the first object in the document for editing.
ActiveDocument.InlineShapes(1).OLEFormat.Edit
' Make Mychart equal to MsGraph.Chart.8 object.
Set Mychart = ActiveDocument.InlineShapes(1).OLEFormat.Object
' Change the value in the datasheet cell referenced in the range.
Mychart.Application.DataSheet.Range("a1").Value = "75"
Mychart.Application.Update
' Change the chart type (remove the apostrophe from the beginning of
' the line that corresponds with the type of chart you want to change
' to).
'Mychart.Application.Chart.ChartType = xlBarStacked
'Mychart.Application.Chart.ChartType = xlPie
Mychart.Application.Quit
Set Mychart = Nothing
' Deselect the edited graph by moving insertion point.
Selection.HomeKey Unit:=wdStory, Extend:=wdMove
End Sub
173707 OFF97: How to Run Sample Code from Knowledge Base Articles
Additional query words: wordcon vba vb word
Keywords: kbinfo kbmacroexample KB190239