M
MartinR
I'm trying to update data in an embedded Graph object using VBA in a Word
2007. I can access the data in the graph manually, but the Graph data
structure is not loaded in the data structure and the VBA code fails to
locate the OLEFormat object of the InlineShape.
Any thoughts?
Code follows:
Dim oMSGraphWrapper As Word.InlineShape
Set oDoc = ActiveDocument
oDoc.Application.ScreenUpdating = False
Set oMSGraphWrapper = oDoc.InlineShapes(1)
Set oMSGraphObject = oMSGraphWrapper.OLEFormat.Object <<<<<<<------
FAILS HERE; i.e. OLEFormat = NULL
Set oDataSheet = oMSGraphObject.Application.DataSheet
With oDataSheet
.Range("b2").Value = 10
.Range("b3").Value = 20
.Range("c2").Value = 100
.Range("c3").Value = 200
End With
With oMSGraphObject.Application
.Update
.Quit
.....ETC
2007. I can access the data in the graph manually, but the Graph data
structure is not loaded in the data structure and the VBA code fails to
locate the OLEFormat object of the InlineShape.
Any thoughts?
Code follows:
Dim oMSGraphWrapper As Word.InlineShape
Set oDoc = ActiveDocument
oDoc.Application.ScreenUpdating = False
Set oMSGraphWrapper = oDoc.InlineShapes(1)
Set oMSGraphObject = oMSGraphWrapper.OLEFormat.Object <<<<<<<------
FAILS HERE; i.e. OLEFormat = NULL
Set oDataSheet = oMSGraphObject.Application.DataSheet
With oDataSheet
.Range("b2").Value = 10
.Range("b3").Value = 20
.Range("c2").Value = 100
.Range("c3").Value = 200
End With
With oMSGraphObject.Application
.Update
.Quit
.....ETC