Excel to PowerPoint Hyperlink Runtime error '-2147467259 (80004005) RRS feed

  • Question

  • I have some code that I am running in Excel that builds the PowerPoint presentation in PPT 2010.

    I have everything working, except for the last part which is adding a Hyperlink (that will be in Cell reference Q2 and is a link to a specific YouTube video.

     Set PPT = GetObject(, "Powerpoint.Application")
        Set pptSlide = PPT.ActivePresentation.Slides(PPT.ActivePresentation.Slides.Count)
    Imagenum = 1
         For Each oPPtShp In pptSlide.Shapes
            '~~> You only need to work on Picture place holders
            If oPPtShp.PlaceholderFormat.Type = ppPlaceholderPicture Then
                With oPPtShp
                   If Imagenum = 1 Then paths = "pathoption1" Else
                   If Imagenum = 2 Then paths = "pathoption2"
                   If Imagenum = 3 Then paths = "pathoption3"
                   If Imagenum = 4 Then paths = "pathoption4"
                pptSlide.Shapes.AddPicture paths & objWorkbook.Worksheets(1).Cells(i, 11).Value & ".jpg", msoFalse, msoTrue, _
                                  .Left, .Top, .Width, .Height
                oPPtShp.ActionSettings(ppMouseClick).Hyperlink.Address = "http://www.google.com/"
                        Imagenum = Imagenum + 1
                End With
            End If
        Set oPPtSlide = Nothing
        Set oPPt = Nothing

    My problem is this bit of code here:

    oPPtShp.ActionSettings(ppMouseClick).Hyperlink.Address = "http://www.google.com/"

    As I get a run time error every time it tries to run it.

    Once I have this one linking, It needs to map back to Q2 in the Excel spreadsheet this code is running in.

    Error message is Runtime error '-2147467259 (80004005)'; Automation error Unspecified error

    Friday, May 30, 2014 1:20 AM