I am trying to set the application.calculation property in an embedded excel workbook object in a powerpoint file using a powerpoint vba macro. With the code below I am receiving the error:
'Unable to set the Calculation property of the Application class'
This would really help performance if I can get this to work.
Public oPres As Object
Public osld As Object
Public oshp As Object
Public total As Integer
Public count As Long
Public oxlbook As Object
Public oxlapp As Object
Public oxlchtsht As Object
Public oxldatsht As Object
Public oxlqrysht As Object
Public oxlqt As Object
--------------------------------------------------------------
Public Sub update_ppt()
Set oPres = ActivePresentation
total = ActivePresentation.Slides.count
count = 0
sttime = Now
progressForm.Show
With oPres
For Each osld In .Slides
count = count + 1
Call chtupdate(osld)
Call UpdateProgress
Next osld
End With
progressForm.Hide
endtime = Now
elptime = (sttime - endtime)
tottime = Format(elptime, "nn:ss")
msg = "Update Done" & vbCrLf & vbCrLf
msg = msg & "Elapsed Time: " & tottime
MsgBox msg
End Sub
-----------------------------------------------------------
Private Sub chtupdate(oSlide As Object)
For Each oshp In oSlide.Shapes
If oshp.Type = msoEmbeddedOLEObject Then
Set oxlbook = oshp.OLEFormat.Object
Set oxlchtsht = oxlbook.Worksheets("charts")
Set oxldatsht = oxlbook.Worksheets("data")
Set oxlqrysht = oxlbook.Worksheets("query")
oxlbook.Application.Calculation = xlCalculationManual
For Each oxlqt In oxlqrysht.QueryTables
oxlqt.Refresh BackgroundQuery:=False
Next oxlqt
oxlbook.Application.Calculation = xlCalculationAutomatic
DoEvents
End If
Set oxlqt = Nothing
Set oxlbook = Nothing
Next oshp
End Sub
Thanks
Erick
Bookmarks