Recording your own macros can be very useful although there will be times when you want to write a macro from scratch.
Examples of good VBA code can be found on web sites and in newsgroups and forums which you might find useful.
You might want to use this code or modify the code to make it specific to the task at hand.
It is very easy to create a macro to allow you to enter (or copy and paste) the necessary code.

Using the Macro dialog box

Select (Tools > Macro > Macros) to display the Macros dialog box.
Enter the name in the Macro name box.
The default location for any macros you create is the active presentation.
Press Create to create the macro.

alt text

Insert or Write the Code

The Visual Basic for Applications window will be opened automatically.
You will see that a code module has been added to the active presentation and that the following code has been added:

alt text

You are now ready to insert or paste in you own VBA code.
Once you have entered your VBA code select (Debug > Compile) to make sure your code does not contain any syntax errors.
After you have finished you can return to PowerPoint by selecting (File > Close and Return to Microsoft PowerPoint).

Save your changes

Then select (File > Save) to save the macro in that template.
You can actually run the macro while you are in the Visual Basic Editor window by pressing F5.
You can also resize the windows so you can see them both at the same time.
You can then run the macro by selecting (Tools > Macro > Macros), selecting the name of the macro and pressing the "run" button.


If you are writing VBA code then make sure the following two options are selected in your (Tools > Options)(Editor tab) of the Visual Basic Editor window: "Auto List Members" and "Auto Quick Info".

© 2023 Better Solutions Limited. All Rights Reserved. © 2023 Better Solutions Limited TopPrevNext