reza_doang
Board Regular
- Joined
- May 31, 2010
- Messages
- 187
Hi,
I have below macro to update the graphs automatically from Excel to PPT.
i was run normally using old laptop, now i upgraded the laptop, and when i ran it showed error
"method activate of object chartdata failed"
can you please help whats wrong with it ?
below the macro
[TABLE="class: grid, width: 500, align: left"]
[TR]
[TD]Sub UpdateAll()
‘UnGroup All
Dim oShp As Shape
Dim oSlp As Slide
For Each oSlp In ActivePresentation.Slides
For Each oShp In oSlp.Shapes
Select Case oShp.Type
Case Is = msoGroup, msoTable
oShp.Ungroup
End Select
Next
Next
Call UpdateObject
End Sub
Private Sub UpdateObject()
Dim oShp As Shape
Dim oSld As Slide
For Each oSld In ActivePresentation.Slides
For Each oShp In oSld.Shapes
If oShp.Type = msoLinkedOLEObject Then
oShp.LinkFormat.Update
End If
Next
Next
Call UpdateCharts
End Sub
Private Sub UpdateCharts()
Dim oSld As Slide
Dim oShp As PowerPoint.Shape
For Each oSld In ActivePresentation.Slides
For Each oShp In oSld.Shapes
With oShp
If .HasChart Then
.Chart.ChartData.Activate
.Chart.ChartData.Workbook.Close
.Chart.Refresh
End If
End With
Next oShp
Next oSld
End Sub
[/TD]
[/TR]
[/TABLE]
I have below macro to update the graphs automatically from Excel to PPT.
i was run normally using old laptop, now i upgraded the laptop, and when i ran it showed error
"method activate of object chartdata failed"
can you please help whats wrong with it ?
below the macro
[TABLE="class: grid, width: 500, align: left"]
[TR]
[TD]Sub UpdateAll()
‘UnGroup All
Dim oShp As Shape
Dim oSlp As Slide
For Each oSlp In ActivePresentation.Slides
For Each oShp In oSlp.Shapes
Select Case oShp.Type
Case Is = msoGroup, msoTable
oShp.Ungroup
End Select
Next
Next
Call UpdateObject
End Sub
Private Sub UpdateObject()
Dim oShp As Shape
Dim oSld As Slide
For Each oSld In ActivePresentation.Slides
For Each oShp In oSld.Shapes
If oShp.Type = msoLinkedOLEObject Then
oShp.LinkFormat.Update
End If
Next
Next
Call UpdateCharts
End Sub
Private Sub UpdateCharts()
Dim oSld As Slide
Dim oShp As PowerPoint.Shape
For Each oSld In ActivePresentation.Slides
For Each oShp In oSld.Shapes
With oShp
If .HasChart Then
.Chart.ChartData.Activate
.Chart.ChartData.Workbook.Close
.Chart.Refresh
End If
End With
Next oShp
Next oSld
End Sub
[/TD]
[/TR]
[/TABLE]