|
||
---|---|---|
PowerPoint tips, hints and tutorials that will change your presentations for ever! | ||
Jigsaws |
Run Code When PowerPoint Opens In most office programs it is possible to run code when the document opens. In Excel for example you have a Workbook_Open Event. Not so in PowerPoint. Most information will tell you either that this cannot be done OR to use a Sub named Auto_Open. Auto_Open will ONLY work from a ppa or ppam Add In which restricts its use severely for the normal user. However in xml based versions (from 2007) it is possible to run code when the presentation loads, the equivalent of the Workbook_Open event. How? First create the sub you want to auto open, in our example it must be named OnLoadCode but it should be obvious how to change this if you read on.
Probably your code will do a little more than this! Now save as a .pptm macro enabled file. XML The easiest way to add XML is to use the free RibbonXEditor which you can download here: Release Office RibbonX Editor 1.9.0 (Build 1056) · fernandreu/office-ribbonx-editor · GitHub You may find the file hard to find. Scroll down to assets and we suggest using this file.
Once installed start theRibbonXEditor and use it to open the saved pptm file. Now choose Insert>Office 2007Custom UI Part (this will also work in 2010)
Now paste in this XML: <customUI
xmlns="http://schemas.microsoft.com/office/2006/01/customui" This simply means that onLoad the code in the sub OnLoadCode will run. Be careful with upper and lower case - it matters! The code will only run if macro security is set low enough. Note that onLoad refers to the RIBBON onLoad event not the presentation load event. If there is no ribbon the event will not fire. Opening a .ppsm file direct to show mode will NOT fire the event because the ribbon does not load. File Save and you are done. Test it out!
|
|
Articles on your favourite sport Free Microsoft PowerPoint Advice, help and tutorials, Template Links |