E
ExcelReport
I have an Excel Chart object (Excel.Chart.8) in MS Word document. I'm trying
to access the chart. But I sometimes get an error. The following is my
program.
Dim i As Integer
Dim strProgId As String
For i = 1 To gwdDoc.InlineShapes.Count
With gwdDoc.InlineShapes(i)
If .Type = wdInlineShapeEmbeddedOLEObject Then
'wdInlineShapeEmbeddedOLEObject=1
strProgId = .OLEFormat.ProgId 'I sometimes get an error
If Left(strProgId, 11) = "Excel.Chart" Then
.OLEFormat.Activate
Set objOLE = .OLEFormat
Exit Function
End If
End If
End If
End With
Next i
I debuged the code. I can not somtetimes access the property ProgId, and get
the error message. "No ProgID is available for this object."
Sometimes it is OK. sometimes it is error. Very strange. I accessed the
property ClassType, and I get the value "Excel.Chart.8".
Any idea?
Thanks advance,
Liu Jianzhong
to access the chart. But I sometimes get an error. The following is my
program.
Dim i As Integer
Dim strProgId As String
For i = 1 To gwdDoc.InlineShapes.Count
With gwdDoc.InlineShapes(i)
If .Type = wdInlineShapeEmbeddedOLEObject Then
'wdInlineShapeEmbeddedOLEObject=1
strProgId = .OLEFormat.ProgId 'I sometimes get an error
If Left(strProgId, 11) = "Excel.Chart" Then
.OLEFormat.Activate
Set objOLE = .OLEFormat
Exit Function
End If
End If
End If
End With
Next i
I debuged the code. I can not somtetimes access the property ProgId, and get
the error message. "No ProgID is available for this object."
Sometimes it is OK. sometimes it is error. Very strange. I accessed the
property ClassType, and I get the value "Excel.Chart.8".
Any idea?
Thanks advance,
Liu Jianzhong