A powerpoint 2010 Add-in to detect a 'PresentationNewSlide' event. My first attempt at an addIn did not succeed.

When Powerpoint 2010 opens a specific template, and a NEW SLIDE is added, I wish VBA to automatically modify the text of the template footer, to display the pptx file name, on each slide.

However, EE expert JSRWilson (http://www.experts-exchange.com/articles/4496/PowerPoint-Events) writes that Powerpoint has no internal 'xl_workbook'-style events. Instead I should write a 'PresentationNewSlide' event via an addIn.

Following the EE article, I made a class module and a standard module in a PowerPoint macro-enabled template (fileName: PPMacro_Enabled_Template 22062015) as a 'Microsoft PowerPoint Macro-Enabled Design Template'

The class module contained this code:
Private Sub PPTEvent_PresentationNewSlide(ByVal Sld As Slide)
    MsgBox "You inserted slide " & Sld.SlideIndex
End Sub

and the module was located at C:\Users\Roger\AppData\Roaming\Microsoft\Templates

Having closed all powerpoint applications, I connected to this addin via the Add-in browser of the Powerpoint file in which I wanted to detect the addition of a new slide.  However, when I added a new slide, the msgbox in the class module (above) did not fire.

Can you tell me what I need to do to get this going?

I attach:
- the addin as a Microsoft PowerPoint Macro-Enabled Design Template, this has been imported to EE site as .POT file (since site does not recofnise .POTM files). PLEASE rename as .POTM before opening!!
- 'help_uc_15_06_22_12_35_32' in which I need to detect a 'PresentationNewSlide' event via vba. Likewise this is presented as a .pptx file and needs to be opened as a pptm version.... please change pptx to pptm

Thanks,
Kelvin
PPMacro-Enabled-Template-22062015.pot
help-uc-15-06-22-12-35-32---Copy.pptx
Kelvin4Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jamie GarrochSenior Technical Consultant at BrightCarbonCommented:
Hi Kelvin,

Have you initialised the event handler? You can either do this in a special Auto_Open sub which runs when the add-in loads but I prefer to trigger it from the onLoad event of the ribbon's XML (even if you don't have a ribbon) because Auto_Open can trigger when PowerPoint is loaded by Windows Explorer when previewing presentation files.

Check out this article I wrote on the topic:

http://www.experts-exchange.com/articles/17410/Initializing-PowerPoint-Events-with-VBA-and-Ribbon-XML.html

In parallel, I'll download your file(s) now and take a look.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Kelvin4Author Commented:
Hi Jamie,
Thanks; I read your article and added my 'vote'.
I knew about Auto_open from the other article (above) but I may have accidentally omitted it.
Kelvin4Author Commented:
Hi Jamie:
I followed your article.
Using the xml ribbon method for calling the new cls:
  (http://www.experts-exchange.com/articles/17410/Initializing-PowerPoint-Events-with-VBA-and-Ribbon-XML.html)
- I created an application event to trigger when a new slide is created.

It worked well. I saved it as ppEvents 25062015 v1.POTM, (located: C:\Users\Roger\AppData\Roaming\Microsoft\Templates), opened it as a template in a new instance of pptm, and the 'new slide' event reported via msgbox when the template first opened (because it showed slide 1), and also reported each time I added a new slide.

Then I closed things, and came back to it. Opened a new instance of pptm, opened aNEW ppEvents 25062015 v1.POTM, and got a warning - macro cant be found or macro not allowed to run.

I checked that the C:\Users\Roger\AppData\Roaming\Microsoft\Templates IS registered a trusted (Trust Centre) - it IS.
I ensured the folder holding my Opened a new instance of pptm is registered as trusted - it is.

I tried to down load your demo file from your article (so I could use it to see if it was allowed to run events), but the download site could not find it.

*** So I'm a bit stymied!

MY PURPOSE - is to use Excel vba to create a new instance of powerpoint, open the template with the new slide event detection, name the presentation with a name automatically provided by excel. When a new slide is created, use VBA find and replace to replace tagged text in the slide footer (also in the template) with the NAME of the presentation. ALL this because powerpoint has no quick parts for displaying the file name on the footer of each powerpoint page.

These procedures work fine, until I go n add ppEvents 25062015 v1.POTM into the mix!

Aside from this writing to fileName to footer on each page, I have no additional requirement for vba events of other modules in powerpoint.

However, when I use powerpoint for other purposes, I dont want to trigger  events in ppEvents 25062015 v1.POTM

I attach my  ppEvents 25062015 v1.POTM--- but as a  .POTM file, PLEASE RENAME before running. (The EE file uptake site does not accept .POTM file extensions)

Seems there is something basic that I've overlooked?

Thanks, Kelvin
ppEvents-25062015-v1---Copy.pot
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Kelvin4Author Commented:
PS:
When I directly open open template: ppEvents 25062015 v1.POTM by manually clicking on the template file in the folder C:\Users\Roger\AppData\Roaming\Microsoft\Templates, I get the same error report... macro either not found or not allowed to run.
Kelvin4Author Commented:
pps:
OK, I've got the .potm file to function correctly, from a regular directory folder that is trusted.
best write these recent experiences off as user unfamiliary!
Thanks for your valuable help.

Kelvin
Kelvin4Author Commented:
Rapid and very effective help in a new area for me.
Thanks!
Kelvin
Jamie GarrochSenior Technical Consultant at BrightCarbonCommented:
Glad you got it sorted Kelvin and sorry I wasn't around today to assist. The Sun was shining!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft PowerPoint

From novice to tech pro — start learning today.