K
Kevin Dufendach
Using VBA to change properties (visibility, text, transparency) of a shape on
a slide with many others runs slowly.
I have a slide with a shape set to run the following code (below) which
toggles the visibility of another shape and toggles a document tag.
Everything works as expected, but the update takes about 0.5 seconds (on a
Centrino Duo 1.66 GHz).
I believe the slow execution has to do with the number of other shapes on
the slide (about 70). If I create a new first slide and copy the over to it,
it runs almost instantaneously. If I then add several shapes to that new
slide, it again runs slowly. I've tried referencing the object directly
(.Slides(1).Shapes(56).Fill.Visible = msoTrue), but that doesn't seem to
change anything. Does anyone know if there is a better way for me to be
referencing shapes or changing properties to speed things up?
Thanks so much!
Kevin
'''''''''''''''''''''''''
Sub ToggleShow1()
On Error GoTo OnError
With ActivePresentation
Select Case .Tags("Show1")
Case "False"
.Tags.Add "Show1", "True"
.Slides(1).Shapes("Check1").Fill.Visible = msoTrue
Case Else
.Tags.Add "Show1", "False"
.Slides(1).Shapes("Check1").Fill.Visible = msoFalse
End Select
End With
NoErrors:
Exit Sub
OnError:
End Sub
''''''''''''''''''''''''''''''
a slide with many others runs slowly.
I have a slide with a shape set to run the following code (below) which
toggles the visibility of another shape and toggles a document tag.
Everything works as expected, but the update takes about 0.5 seconds (on a
Centrino Duo 1.66 GHz).
I believe the slow execution has to do with the number of other shapes on
the slide (about 70). If I create a new first slide and copy the over to it,
it runs almost instantaneously. If I then add several shapes to that new
slide, it again runs slowly. I've tried referencing the object directly
(.Slides(1).Shapes(56).Fill.Visible = msoTrue), but that doesn't seem to
change anything. Does anyone know if there is a better way for me to be
referencing shapes or changing properties to speed things up?
Thanks so much!
Kevin
'''''''''''''''''''''''''
Sub ToggleShow1()
On Error GoTo OnError
With ActivePresentation
Select Case .Tags("Show1")
Case "False"
.Tags.Add "Show1", "True"
.Slides(1).Shapes("Check1").Fill.Visible = msoTrue
Case Else
.Tags.Add "Show1", "False"
.Slides(1).Shapes("Check1").Fill.Visible = msoFalse
End Select
End With
NoErrors:
Exit Sub
OnError:
End Sub
''''''''''''''''''''''''''''''