![]() |
||
---|---|---|
PowerPoint tips, hints and tutorials that will change your presentations for ever! | ||
Jigsaws |
Starting to Write VBA Lesson One Learn how to open the VB editor, insert a module and write and run a simple subroutine. First lets open the visual basic editor. This is where you write and edit your program. Press ALT and f11 to open it,
Your editor may look a little different . Now from the VB Editor INSERT menu choose insert a mdule, this is where your first code will go. Name and write the Subroutine Type into the new module Sub MyFirstSub and press ENTER. PowerPoint will automatically add some code so it looks like this. For now you can ignore the brackets but do not delete them.
You have created a sub called MyFirstSub! You can choose your own name but you cannot start with a number or use SPACES / | * - + or some other non letters. If you do the line will turn red to warn you. You code goes between the two lines. Type in the code below. It's boring but shows how to make the PC give a message.
Press f5 or choose Run > run sub/Userform to see what it does. Make it run when a shape is clicked. In PowerPoint you do NOT need to use command buttons to run code. Insert a circle or any other shape and give it an ACTION of run macro. Where this command is depends on the version of PowerPoint either INSERT tab or SlideShow menu. Run the slide show (it won't work in edit mode) and click the button. Congratulations your first code running in a slide show.
|
|
Articles on your favourite sport Free Microsoft PowerPoint Advice, help and tutorials, Template Links |