G
gbl
I've got a pretty simple app I've tried writing within powerpoint as a set of
vba procedures and also as an add-in and yet again as a visual basic exe that
calls out to powerpoint. I can provide the code if needed but I was just
wondering if there is a known issue that powerpoint has a memory leak or just
hangs if you have large ( 150-200 slide) presentations. My code is simply
trying to change the absolute links in shapes to relative links but the code
fails randomly even if I'm just stepping through every slide in a loop and
then stepping through every shape without actually doing anything. Note
that this code was failing even before I put in the recursive HandleGroup
routine and none of the slides has grouping more than 2 or 3 levels.
in pseudo code I'm just doing the following....
....
Set theView = p.Windows(1).View
For Each sld In p.Slides
theView.GotoSlide sld.SlideIndex
For Each shp In sld.Shapes
If (shp.Type = msoGroup) Then
HandleGroup p, shp.GroupItems
Else
HandleShape p, shp
End If
Set shp = Nothing
Next 'shape
Set sld = Nothing
Next 'slide
......
Sub HandleGroup(p As Presentation, theGroup As GroupShapes)
Dim shp As Shape
For Each shp In theGroup
If (shp.Type = msoGroup) Then
HandleGroup p, shp.GroupItems
Else
HandleShape p, shp
End If
Next 'shp
End Sub
Sub HandleShape(p As Presentation, shp As Shape)
Dim theFlash As ShockwaveFlash
If shp.Type = msoMedia Then
If shp.MediaType = ppMediaTypeMovie Then
Call Handlemovie(p, shp) ' make the path to the movie file
relative
End If 'shp.mediatype
ElseIf shp.Type = msoOLEControlObject Then
If InStr(1, shp.OLEFormat.ProgID, "flash", vbTextCompare) Then
Set theFlash = shp.OLEFormat.Object
Call HandleFlash(p, theFlash) 'make the path to the flash movie
relative
End If
End If 'shp.type
End Sub
I'm pretty sure that I've not got any leaks (i.e any objects I "set" to
nothing as soon as I'm through with them)
Sometimes I can run the macro once , sometimes twice very rarely 3 times
before powerpoint either hangs, or just puts up a dialog saying it has run
into an unexpected error.
Another thing I've noticed is when I get that powerpoint "unexpected error"
dialog , after quitting powerpoint from file/exit. If I go into the task
window there is still a powerpoint process running though there is NOT one
running with any user interface that I can see.
I'm using office 2000 with all the latest patches (as of 3Mar2005)
thanks for any tips.
vba procedures and also as an add-in and yet again as a visual basic exe that
calls out to powerpoint. I can provide the code if needed but I was just
wondering if there is a known issue that powerpoint has a memory leak or just
hangs if you have large ( 150-200 slide) presentations. My code is simply
trying to change the absolute links in shapes to relative links but the code
fails randomly even if I'm just stepping through every slide in a loop and
then stepping through every shape without actually doing anything. Note
that this code was failing even before I put in the recursive HandleGroup
routine and none of the slides has grouping more than 2 or 3 levels.
in pseudo code I'm just doing the following....
....
Set theView = p.Windows(1).View
For Each sld In p.Slides
theView.GotoSlide sld.SlideIndex
For Each shp In sld.Shapes
If (shp.Type = msoGroup) Then
HandleGroup p, shp.GroupItems
Else
HandleShape p, shp
End If
Set shp = Nothing
Next 'shape
Set sld = Nothing
Next 'slide
......
Sub HandleGroup(p As Presentation, theGroup As GroupShapes)
Dim shp As Shape
For Each shp In theGroup
If (shp.Type = msoGroup) Then
HandleGroup p, shp.GroupItems
Else
HandleShape p, shp
End If
Next 'shp
End Sub
Sub HandleShape(p As Presentation, shp As Shape)
Dim theFlash As ShockwaveFlash
If shp.Type = msoMedia Then
If shp.MediaType = ppMediaTypeMovie Then
Call Handlemovie(p, shp) ' make the path to the movie file
relative
End If 'shp.mediatype
ElseIf shp.Type = msoOLEControlObject Then
If InStr(1, shp.OLEFormat.ProgID, "flash", vbTextCompare) Then
Set theFlash = shp.OLEFormat.Object
Call HandleFlash(p, theFlash) 'make the path to the flash movie
relative
End If
End If 'shp.type
End Sub
I'm pretty sure that I've not got any leaks (i.e any objects I "set" to
nothing as soon as I'm through with them)
Sometimes I can run the macro once , sometimes twice very rarely 3 times
before powerpoint either hangs, or just puts up a dialog saying it has run
into an unexpected error.
Another thing I've noticed is when I get that powerpoint "unexpected error"
dialog , after quitting powerpoint from file/exit. If I go into the task
window there is still a powerpoint process running though there is NOT one
running with any user interface that I can see.
I'm using office 2000 with all the latest patches (as of 3Mar2005)
thanks for any tips.