About
Powerpoint Alchemy Amazing techniques and tips
Amazing techniques which will transform your use of PowerPoint presentations. Make your presentation stand out from the crowd!
Google
 

PowerPoint vba

Lots of places on the internet publish vba code. If you don't know what to do with it ......

First should you use vba?

For your own use definitely, it can streamline tasks. However if you distribute your presentations there can be problems:

  • If the user has only the free viewer the code just won't work!
  • If the user has macro security set higher than medium the code won't load.
  • If your code crashes the user may end up in the visual basic editor which is a BAD idea!

Where can I Find Code?

Lots of places but the Powerpoint forum, and the programming section of pptfaq are good places and of course on these pages.

How Do I Use Code? (see below if you have 2007)

Copy the code from your source, it will normally start with Sub modulename() and end with End Sub. From Powerpoint open the vb editor by either pressing Alt + f11 or Tools >Macro>visual basic editor. Once there use the INSERT menu to insert a module. (see diagram 1)

Paste in the code it should now look a little like Diagram 2 (with different code of course).

To run code in edit view Tools > Macro >Macros > Run or much easier view > toolbars > visual basic and use the tools there (see diagram 3) The red arrow = run macro and the green go to vb editor.

To run code in slide show view the easiest way is to give an action button or a shape an action setting of Run > Macro. Do this with the Slide show > action settings menu. (Diagram 4)

I Have PowerPoint 2007 or Later

If you have PowerPoint 2007 you should enable the Developer tab to access the toolbars described above. To do this go to the big Office button > PowerPoint Options > Popular

In 2010/2013 go to Options > Customize ribbon and tick DEVELOPER

Run the macro from VIEW Tab > Macros

Enable the Developer Tab

 

Remember to set your macro security at Medium (Disable with prompt) or saved code won't run!!

 

Insert a module in the vb editor
Diagram 1

vb code sample
Diagram 2

vba toolbar
Diagram 3

Action settings
Diagram 4

 

 

This website is sponsored by Technology Trish Ltd
© Technology Trish 2007
Registered in England and wales No.5780175