![]() |
Leading the way in Microsoft Office Development |
| Home | | | Excel | | | Word | | | PowerPoint | | | Consultancy | | | Feedback | | | Contact |
| Microsoft PowerPoint > Add-ins > Creating a PowerPoint Add-in | < Previous | Next > |
Step 1 - Create a Presentation ".ppt" |
To create a PowerPoint add-in you must first create a PowerPoint presentation as normal. | ||
It is highly recommended that you test your code thoroughly before creating the add-in. | ||
There will not always be an active presentation, so any references to the "ActiveWindow" will cause an error if there are no presentations open. | ||
Make sure you keep a copy of the original presentation because you cannot make any changes to the VBA code once the add-in has been created. | ||
In fact you will not even see the VBA Project in the Visual Basic Editor. | ||
If you want to activate any of your macros from shortcut keys these must be added before the presentation is converted to an add-in. You will not be able to do this afterwards. |
Step 2 - Write some VBA Code |
The code below is a very simple add-in that displays the number of slides in the active presentation. | ||
An additional command will be added to the top of the Tools drop-down menu to allow you to display the number of slides. | ||
You will need to include some initialisation code in your add-in that will be run automatically when the add-in is loaded. |
|
You should also include some clean-up code which will run when the add-in is unloaded. |
|
This subroutine will display the number of slides in the active presentation. |
|
Step 3 - Provide a Name and Description |
Unlike Excel the name and the description of your add-in is not displayed in the (Tools > Add-ins). | ||
Filling in the (File > Properties)(Summary tab) for PowerPoint add-ins is less important. | ||
The name that appears in the (Tools > Add-ins) dialog box is just the file name of the PowerPoint add-in so it is important to save your add-in with a meaningful name. |
Step 4 - Protecting your Code |
It is often a good idea to protect your code from being viewed and modified. This can be done by password protecting the project. | ||
This is less important for PowerPoint add-ins since the VBA Project cannot be seen when the add-in is loaded. | ||
This can be done by filling in the (Tools > VBAProject Properties)(Protection tab). | ||
To prevent a project from being viewed check the "Lock project for viewing" check box and enter a password. | ||
Try to use a password that you will remember as there is no way to access the code if you forget the password. | ||
The contents of the Confirm Password box and the Password box must match when you press OK or you get an error. |
![]() | (Tools > VBAProject Properties)(Protection tab) |
If you do not check the Lock Project for Viewing option but set a password, you will be required to enter a password the next time you open the (Tools > VBAProject Properties) dialog box. | ||
It is probably also worth giving your VBA project a name and description. This can be done from the General tab. | ||
Any passwords and locking that you apply to your project will not take effect until the project is closed and reopened. |
Step 5 - Save as a PowerPoint Add-in (".ppa") |
You should always recompile your code before saving the presentation as an add-in. | ||
If the code has not been pre-compiled then your add-in will take slightly longer to run the first time. | ||
You can compile your code by selecting (Debug > Compile). | ||
To save your presentation select (File > SaveAs) to display the Save As dialog box. | ||
Select PowerPoint Add-In (*.ppa) from the "Save as Type" drop-down. |
![]() | (File > SaveAs) dialog box |
The folder path will change automatically to the default folder path for your add-ins. | ||
PowerPoint 2003 - C:\Documents and Settings\"user name"\Application Data\Microsoft\Addins\ | ||
PowerPoint 2002 - C:\Documents and Settings\"user name"\Application Data\Microsoft\Addins\ | ||
PowerPoint 2000 - C:\Program Files\Microsoft Office\Office\Library\ | ||
PowerPoint 97 - C:\Program Files\Microsoft Office\Office\Library\ | ||
It is possible to save the add-in to a different directory. | ||
Once you are happy with the name of the your add-in and the folder which it will be saved to press "OK". | ||
The PowerPoint add-in will be saved although your original presentation will remain open. |
Step 6 - Things to Remember |
Any procedures in an Add-in are not displayed in the (Tools > Macro > Macros) dialog box. | |||
If you want PowerPoint to automatically install your add-in then save it in the default "Add-ins" folder. | |||
Your comments are not automatically removed when the file is saved as an Add-in. Removing all the comments will help to reduce the file size. | |||
PowerPoint add-ins should be as small as possible. The smaller the file size the faster they load. | |||
Once a PowerPoint document has been converted to an add-in the VBA Project will be unviewable. |
| Copyright © 2004-2007 Better Solutions Limited. All Rights Reserved. | < Previous | Top | Next > |