Insert slides from existing presentation via access

fkneg1

Registered User.
Local time
Today, 12:42
Joined
Aug 11, 2013
Messages
23
Hi,
I am using VBA in Access to create a PowerPoint presentation using the data in the database. I have got this working adding new slides and formatting them but I would also like to add slides from an existing presentation. I have tried the code below but it is not inserting the slides and is also not giving me any error messages. Any ideas of where I have gone wrong?
Code:
If (rs.Fields("song 8").Value) = "(none)" Then
    ElseIf (rs.Fields("song 8").Value) = "PowerPoint slides 1" Then
'vvvvvvvvvvvvvvvvvvvvvvvv  THIS BIT IS NOT WORKING vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
        ActivePresentation.Slides.InsertFromFile _
        "D:\AA - Test\Tester.pptx", 1, 2, 4
'^^^^^^^^^^^^^^^^^^^^^^^^  THIS BIT IS NOT WORKING ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Else
        With .Slides.Add(rs.AbsolutePosition + 1, ppLayoutTitleOnly)
            .FollowMasterBackground = False
            .Background.Fill.Solid
            .Background.Fill.ForeColor.RGB = RGB(0, 0, 0)
                With .Shapes(1)
                    .Left = 100
                    .Top = -100
                End With
                With .Shapes(1).TextFrame.TextRange
                    .Text = "BLANK BETWEEN SONG 8 AND END"
                End With
        End With
End If
 
You only posted a part of the code, but I guess you're missing the reference to the active PowerPoint presentation, then if you haven't set ActivePresentation to the active PowerPoint presentation, it is unknown to MS-Access,
 
Thanks. I had to just leave it as .slides.insertfromfile... without the ActivePresentation.
 

Users who are viewing this thread

Back
Top Bottom