Powerful PowerPoint for Educators: Using Visual Basic for Applications to Make PowerPoint Interactive


Figure 4.4. Get ting a Blank Ac tion But ton


Download 1.37 Mb.
Pdf ko'rish
bet39/191
Sana08.05.2023
Hajmi1.37 Mb.
#1442581
1   ...   35   36   37   38   39   40   41   42   ...   191
Bog'liq
2.2. Powerful PowerPoint For Educators

Figure 4.4. Get ting a Blank Ac tion But ton
You can draw the but ton by drag ging the mouse to form the but ton or just
clicking where you want the but ton to ap pear on the slide. Once you let go of the
mouse you will be presented with the Actions Settings dialog box (see Fig ure
4.5). Choose Run Macro, and se lect SayHello (the name of the pro cedure you
just wrote) as the macro to run. Click OK.
Buttons are only active in Slide Show View, so go to Slide Show View
(choose “View Show” from the Slide Show menu or click on the Slide Show
icon
in the lower left cor ner of the screen). Now, click on your but ton, and
you should get the same “Hello” message you got earlier when running your
procedure (see Figure 4.2, page 42).
44 Getting Started with VBA


Fig ure 4.5. Ac tion Set tings Di a log Box
Now go back to Edit View (also known as Normal View) by hitting the Es -
cape key on your keyboard. To fin ish your button, right-click (control click on a
Macintosh) on it and choose “Add Text” from the flyout menu. You can now add 
text to de scribe what your button does. This text will show up on the but ton, so
users will know what they are clicking when they click your but ton.
Tying Your VBA Script to Any Object
You can tie your VBA script to any ob ject you want, not just a but ton. Use
the drawing tools to draw a shape (there are several in teresting ones from which
to choose in the AutoShapes menu of the Draw toolbar). Once you have drawn
the shape, click on it to select it. Now choose “Ac tion Set tings” from the Slide
Show menu. You will get the same di alog box shown in Fig ure 4.5, and you can
choose Run Macro and the SayHello macro, exactly as you did above. Now you
can click on the drawn ob ject just like you can click on the button.
This method works for any PowerPoint ob ject, not just the ones you draw
yourself. You can in sert clip art and make it clickable by assigning Action Set-
tings (just like you do to shapes you draw your self) to run your script. You can
copy and paste pic tures from other sources (such as the Web). You can even
make text in your slide clickable by high lighting the text and choos ing “Ac tion
Set tings” from the Slide Show menu.
Tying Your VBA Script to Any Ob ject 45



Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   35   36   37   38   39   40   41   42   ...   191




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling