If re
sult = vbYes Then 'Was the Yes but
ton clicked?
ActivePresentation.SlideShowWindow.View.Exit
Else 'Since Yes was
n’t clicked, it must be No
ActivePresentation.SlideShowWindow.View.Next
End If
End Sub
With the ad ditional power of
MsgBox
, you have an other tool to do something
based on the answers to simple questions. By combining this with navigational com -
mands from the previous section, you can let the user go anywhere in your presenta-
tion based on the an swers to questions. But moving from slide to slide isn’t the only
response. You might want to stay on the same slide and have something magical hap -
pen. In the next section, you will learn how to make ob jects appear and disappear.
Hiding and Show ing PowerPoint Ob jects
In PowerPoint, ev ery ob ject that you see on the screen (text boxes, but tons,
pictures, etc.) has sev eral prop erties that can be controlled by VBA. These might
include the height and width of the ob ject, the text displayed in the ob ject, the
color of the ob ject, etc. An other property is whether or not the ob ject is visible. If
you want to be able to see the ob ject, you can set its
Vis
i
ble
prop erty to
True
(note that VBA has a value that is
msoTrue
; this is the same as
True
for all your
purposes, so don’t worry if the VBA Ed itor sug gests
msoTrue
; you can use
msoTrue
or
True
and it will work). If you want to hide the ob ject, you set its
Vis
i
ble
prop erty to
False
(or
msoFalse
). For example, if you want to hide
the fifth ob ject on the second slide (see “Referencing Ob jects by Number” be low
if you don’t know which is the fifth ob ject), you could use the following line:
Do'stlaringiz bilan baham: |