{"id":114,"date":"2014-02-10T16:56:47","date_gmt":"2014-02-10T16:56:47","guid":{"rendered":"http:\/\/zaffy.co.za\/blog\/?p=114"},"modified":"2014-03-05T15:47:02","modified_gmt":"2014-03-05T15:47:02","slug":"convert-a-macro-to-an-add-in-office-applications-tutorial-for-powerpoint","status":"publish","type":"post","link":"https:\/\/zaffy.co.za\/blog\/computers-it\/convert-a-macro-to-an-add-in-office-applications-tutorial-for-powerpoint\/","title":{"rendered":"Convert a Macro to an Add-in: Office Applications (Tutorial for PowerPoint)"},"content":{"rendered":"<p><strong>Introduction:<\/strong><\/p>\n<p>I wanted to convert a PowerPoint Macro to a PowerPoint Add-in so I could use the same macro code against multiple PowerPoint presentations, regardless of them being macro-enabled or not. For my purposes I needed this done in PowerPoint however I would imagine that the steps would some what similar for Excel and Word. Outlined are the steps I followed after visits to forums and Microsoft documentation.<\/p>\n<p><!--more--><\/p>\n<p><strong>Step 1:<\/strong><b> Create your macro. <\/b><\/p>\n<p><em><b>For purposes of this discussion I assume you already know how to create a macro. If not please refer to the further reading links below.<\/b><\/em><\/p>\n<p><strong>Step 2:<\/strong><b> Paste the code from <a title=\"PPTFAQ Code for Toolbar\" href=\"http:\/\/www.pptfaq.com\/FAQ00031_Create_an_ADD-IN_with_TOOLBARS_that_run_macros.htm\">PPTFAQ.com<\/a>\u00a0in your Powerpoint: to create the tool bars. They have provided a piece of code which creates the tool bar and calls a function called Button1() to allow for testing<\/b><b>. [please find the code at\u00a0<a title=\"PPTFAQ Code for Toolbar\" href=\"http:\/\/www.pptfaq.com\/FAQ00031_Create_an_ADD-IN_with_TOOLBARS_that_run_macros.htm\">PPTFAQ.com<\/a>].\u00a0All you need to do is edit the Button1() and replace with the function you would like called when the button is clicked on the toolbar.<\/b><\/p>\n<p><strong>Step 3:<\/strong><b>\u00a0Create a Self-Signed Digital Certificate with the SelfCert.exe in the office folder under program files. This allows your macro to run as a trusted source, by letting the computer know that the code was written by you. Should you require your eventual add-in to be run on multiple PC&#8217;s you can either generate a self-cert for every PC (lots of effort), decrease the security setting (not recommended) to run untrusted macro&#8217;s or purchase a digital certificate to allow for your add-in to be distributed.<\/b><\/p>\n<p><strong>Step 4:<\/strong> Go to tools in your PowerPoint document, under Visual Basic code and select from the Tools menu, digital certificate.<\/p>\n<p><strong>Step 5:<\/strong> Assign your newly created Self-Signed Digital Certificate to your code. This allows you to execute your code after you converted it to an add-in.<\/p>\n<p><strong>Step 6:<\/strong> Save your file as a Macro enabled Office file , for PowerPoint this is a &#8220;.pptm&#8221; file extension.<\/p>\n<p><b>Note: You have to save your file because once you save it as an add-in you cannot edit the code anymore.<\/b><b>\u00a0<\/b><\/p>\n<p><strong>Step 5:<\/strong>\u00a0Now save your file as an Office add-in , example PowerPoint gives you the option to SaveAs a &#8220;.ppam&#8221; file extension.<\/p>\n<p><strong>Notice:<\/strong> add-ins do not get saved to your folders , they get saved in a trusted folder, in your documents\/appdata (this folder is normally has the hidden attribute applied)<\/p>\n<p><strong>Step 6:<\/strong> Go to File, Options, Add-ins in your office application, click the drop down and select the Office application specific add-in, for example:<\/p>\n<p><b>In PowerPoint you have &#8220;Com-in&#8221; as the default and under that is \u201cPowerPoint add-in\u201d this is the one you want.<\/b><\/p>\n<p><strong>Step 7:<\/strong>\u00a0Select the &#8220;add-in&#8221; you have just saved<\/p>\n<p><strong>Step 8:<\/strong> Test, restart with another non-macro enabled file and see if your ribbon loads properly.<\/p>\n<p><strong>Further reading:<\/strong><\/p>\n<ul>\n<li>Youtube videos on creating macros\n<ul>\n<li><a title=\"Intro Macro in Powerpoint\" href=\"http:\/\/www.youtube.com\/watch?v=uSxhKirTbH4\" target=\"_blank\">Powerpoint Macro intro<\/a><\/li>\n<li><a title=\"Excel Macro Intro\" href=\"http:\/\/www.youtube.com\/watch?v=_HhC5pQZARY\" target=\"_blank\">Excel Macro intro<\/a><\/li>\n<li><a title=\"Word Macro Intro\" href=\"http:\/\/www.youtube.com\/watch?v=Bn_gDpkx9sA\" target=\"_blank\">Word Macro intro<\/a><\/li>\n<li>*There are a lot of video tutorials at different levels of granularity, you may want to search YouTube to find the level the best addresses your needs.<\/li>\n<\/ul>\n<\/li>\n<li><a title=\"PPTFAQ\" href=\"http:\/\/www.pptfaq.com\/index.html\" target=\"_blank\">PPTFAQ.com<\/a> &#8211; Nice resource for Powerpoint, also sell add-ins<\/li>\n<li><a title=\"Online Help - Digital Self-Signed Certificate\" href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/office\/aa141471(v=office.10).aspx\" target=\"_blank\">Microsoft Self-Signed Digital Certifcate<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: I wanted to convert a PowerPoint Macro to a PowerPoint Add-in so I could use the same macro code against multiple PowerPoint presentations, regardless of them being macro-enabled or not. For my purposes I needed this done in PowerPoint however I would imagine that the steps would some what similar for Excel and Word. &hellip; <a href=\"https:\/\/zaffy.co.za\/blog\/computers-it\/convert-a-macro-to-an-add-in-office-applications-tutorial-for-powerpoint\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Convert a Macro to an Add-in: Office Applications (Tutorial for PowerPoint)<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,7],"tags":[],"class_list":["post-114","post","type-post","status-publish","format-standard","hentry","category-computers-it","category-technical"],"_links":{"self":[{"href":"https:\/\/zaffy.co.za\/blog\/wp-json\/wp\/v2\/posts\/114","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zaffy.co.za\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zaffy.co.za\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zaffy.co.za\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/zaffy.co.za\/blog\/wp-json\/wp\/v2\/comments?post=114"}],"version-history":[{"count":13,"href":"https:\/\/zaffy.co.za\/blog\/wp-json\/wp\/v2\/posts\/114\/revisions"}],"predecessor-version":[{"id":141,"href":"https:\/\/zaffy.co.za\/blog\/wp-json\/wp\/v2\/posts\/114\/revisions\/141"}],"wp:attachment":[{"href":"https:\/\/zaffy.co.za\/blog\/wp-json\/wp\/v2\/media?parent=114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zaffy.co.za\/blog\/wp-json\/wp\/v2\/categories?post=114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zaffy.co.za\/blog\/wp-json\/wp\/v2\/tags?post=114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}