Jiri Dobes
Jiri Dobes

Reputation: 11

Content of slides of add-in file - VBA Powerpoint 2010

I would like to create a PowerPoint 2010 add-in with many pre-prepared slides. It will have set of macros (+modification of UI), which will copy content of the slides from the add-in to the active presentation when button pressed.

Does anybody know how to get access to the content of the add-in slides from the macro?

Microsoft says that Presentations( "my_addin.ppam" ) should do the work, see http://msdn.microsoft.com/en-us/library/office/ff743968%28v=office.15%29.aspx To me it seems to be the easiest and preferred way. However, I am getting error message "Item my_addin not found in the Presentation collection."

The route via Addins( "my_addin" ) does not seem to help either. Other way could be setting right variable while loading the add-in...?

Any help/point to the right direction highly appreciated.

Upvotes: 1

Views: 650

Answers (1)

Steve Rindsberg
Steve Rindsberg

Reputation: 11

1) There are no slides in an add-in file. You can't access what's not there. The add-in could insert slides from another PPT/PPTX file though.

2) It seems that the MSDN article you quote is wrong. On the other hand, you can iterate through the Addins collection, rather than the Presentations collection.

Sub ListAddins()
    Dim x As Long
    For x = 1 To AddIns.Count
        Debug.Print AddIns(x).FullName
    Next
End Sub

Sub TestGetAddin()
    Debug.Print GetAddin("showtimer").FullName
End Sub

Function GetAddin(sName As String) As AddIn
    Dim oAddin As AddIn
    For Each oAddin In AddIns
        If UCase(oAddin.Name) = UCase(sName) Then
            Set GetAddin = oAddin
            Exit Function
        End If
    Next
End Function

And on yet another hand that doesn't matter since the add-in PPA/PPAM won't have any slides in it.

But finally, knowing where the add-in is (fullpath or path properties will tell you that) would help you locate a regular PPT/PPTX file with your slides in it.

Upvotes: 1

Related Questions