Hi,
We have an existing solution that uses automation of PowerPoint 2003 to update the datasheet of an embedded Chart (i.e. the standard chart object that is the default when you do Insert/Chart in PowerPoint).
Here is the code I use:
oDataSheet = oGraph.Application.DataSheet
With rstResult.Tables(0) '-- Recordset returned by a SQL query
iColumns = .Columns.Count
'-- Calculate the number of records in the set
iRows = .Rows.Count
End With
'Create an array and populate with data
Dim arrResult(iRows + 2, iColumns)
With rstResult.Tables(0)
'If the result hasn't been written
If bHeadings = False Then
For intCount = 0 To iColumns - 1
scurRow = .Columns(intCount).ColumnName
arrResult(1, 1 + intCount) = scurRow
Next intCount
bHeadings = True
intCurrent = 2
End If
For intRecord = 0 To iRows - 1
curRow = .Rows(intRecord)
For intCount = 0 To iColumns - 1
scurRow = curRow(intCount).ToString
If scurRow <> "" Then
arrResult(intCurrent + intRecord, 1 + intCount) = scurRow
Else
arrResult(intCurrent + intRecord, 1 + intCount) = " "
End If
Next intCount
Next intRecord
End With
With oDataSheet
If intPlotBy = 1 Then 'Chart is plotted by rows
For intColumns = 1 To iRows + 1
arrFormating(intColumns) = .Rows(intColumns).NumberFormat
If arrFormating(intColumns) = "" Then arrFormating(intColumns) = "General"
Next intColumns
Else 'Plotted by Columns
For intColumns = 1 To iColumns
arrFormating(intColumns) = .Columns(intColumns).NumberFormat
If arrFormating(intColumns) = "" Then arrFormating(intColumns) = "General"
Next intColumns
End If
.Cells.Clear()
For intRows = 1 To intCurrent - 1
For intColumns = 1 To intColMax
If intColumns = 1 Then
'.Cells(intRows, intColumns).NumberFormat = strNumForm
End If
If arrResult(intRows, intColumns) <> "" Then
.Cells(intRows, intColumns).Value = arrResult(intRows, intColumns)
Else
If intColumns = 1 Then
.Cells(intRows, intColumns).Value = ""
End If
End If
'.Cells(intRows, intColumns).NumberFormat = strNumForm
Next intColumns
Next intRows
This solution has always been unstable due to the nature of automating a program that doesn't really want to be automated. I would really like to replace this with something like ASPOSE Slides.
My question is - will ASPOSE Slides work with my existing PowerPoint files and reference the objects - I have shed loads of existing objects