Cosmo
06-23-2008, 02:02 PM
I found that when setting data into different charts, the values don't retain their changes when the PPT file is closed. (the charts look like they have the new data, but upon opening them, they revert to their state before the changes were made) A snippet of the code I'm using to set the data:
With oPPTShape
If .Type = 7 Then ' Chart
If TypeName(.OLEFormat.Object) = "Chart" Then
.OLEFormat.Object.Application.datasheet.Range(mColumn & mRow).Value = theValue
ElseIf TypeName(.OLEFormat.Object) = "Workbook" Then
.OLEFormat.Object.Sheets("Sheet1").Range(mColumn & mRow).Value = theValue
End If
End If
End With
I found that opening and closing the charts will make the changes 'stick', so I run this code on each of the charts once the program is finished:
With oPPTShape
If .Type = 7 Then ' Chart
.OLEFormat.DoVerb Index:=1
End If
End With
Is there a better way of doing this? Is there something that can be done when the data is set into the chart to make it retain it's value automatically?
My main reason for asking this, is that I have recently been getting a dialog when setting data into Excel charts in PowerPoint that says "The object is not responding because the source application may be busy". The dialog is from Excel. I have stored references to the objects that I am setting data into in the presentation (a combination of tables, charts, and text fields), but I don't see what is causing this dialog, because I am not setting any references to Excel specifically, and I am not sure what would be keeping Excel busy after running the code which sets the data.
I tried the following:
With oPPTShape
If .Type = 7 Then ' Chart
.OLEFormat.Object.Application.DisplayAlerts = False
End If
End With
hoping that it would suppress this dialog, but it didn't work.
With oPPTShape
If .Type = 7 Then ' Chart
If TypeName(.OLEFormat.Object) = "Chart" Then
.OLEFormat.Object.Application.datasheet.Range(mColumn & mRow).Value = theValue
ElseIf TypeName(.OLEFormat.Object) = "Workbook" Then
.OLEFormat.Object.Sheets("Sheet1").Range(mColumn & mRow).Value = theValue
End If
End If
End With
I found that opening and closing the charts will make the changes 'stick', so I run this code on each of the charts once the program is finished:
With oPPTShape
If .Type = 7 Then ' Chart
.OLEFormat.DoVerb Index:=1
End If
End With
Is there a better way of doing this? Is there something that can be done when the data is set into the chart to make it retain it's value automatically?
My main reason for asking this, is that I have recently been getting a dialog when setting data into Excel charts in PowerPoint that says "The object is not responding because the source application may be busy". The dialog is from Excel. I have stored references to the objects that I am setting data into in the presentation (a combination of tables, charts, and text fields), but I don't see what is causing this dialog, because I am not setting any references to Excel specifically, and I am not sure what would be keeping Excel busy after running the code which sets the data.
I tried the following:
With oPPTShape
If .Type = 7 Then ' Chart
.OLEFormat.Object.Application.DisplayAlerts = False
End If
End With
hoping that it would suppress this dialog, but it didn't work.