donderdag 2 januari 2014

Powerpoint: Starting Templates By Using an Add-in

Powerpoint: Starting Templates By Using an Add-in

Step 1: create template WalMar.potm

Step 2: Adjust the XML of this template by using Custom UI editor; create a custom UI part like this:

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
      <ribbon startFromScratch="false">
            <tabs>
                  <tab id="Templates" label="Templates" insertBeforeMso="TabHome">
                        <group id="WalMar" label="WalMar">
                             <button id="TemplatesWalmar" label="Templates Walmar" imageMso="FilePrepareMenu" size="large" onAction="OpenTemplatesWalmar" />
                        </group>
                  </tab>
            </tabs>
      </ribbon>
</customUI>

The tab will then look like this:


Step 3: Add VBA to WalMar.potm:

Sub OpenTemplatesWalmar ()
    Dim oPA As PowerPoint.Application
    Dim oPP As PowerPoint.Presentation
    Dim strTemplate As String
   
    strTemplate = "D:\WalMar\Templates\Powerpoint\HouseStyle.ppt" 'As an example
   
    Set oPA = New PowerPoint.Application
    oPA.Visible = msoTrue
    oPA.Presentations.Open strTemplate, untitled:=msoTrue
End Sub

Be sure the file HouseStyle.ppt exists at the given location.

Step 4: Save WalMar.potm as an Add-In: WalMar.ppam

Step 5: Save WalMar.ppam at a trusted location

Step 6: Add WalMar.ppam as an Powerpoint add-in

Now every time you start Powerpoint, you will get this new tab called Templates which leads you to the given template.

Een reactie posten