vbamacospowerpointpowerpoint-2016

Can't delete hyperlinks with VBA in PPT2016 (MAC OS)


I have found many example scripts which should work e.g.

Sub DeleteLinks()
    Dim oSl As Slide
    Dim x As Long

    For Each oSl In ActivePresentation.Slides
        For x = oSl.Hyperlinks.Count To 1 Step -1
            oSl.Hyperlinks(x).Delete
        Next
    Next

End Sub

However when I try to run this on Powerpoint on Mac it gives me this:

Compile Error: Method or data member not found

Does this mean this functionality doesn't exist in Mac PPT VBA?


Solution

  • John SR Wilson over on the Microsoft Answers Forum found a way to workaround this so I decided to post it back here in case anyone was wondering

    See if this works on your Mac
    
    Sub killMacLinks()
    Dim ohl As Hyperlink
    Dim osld As Slide
    Dim asT As ActionSetting
    Set osld = ActiveWindow.Selection.SlideRange(1)
    For Each ohl In osld.Hyperlinks
    Set asT = ohl.Parent
    asT.Action = ppActionNone
    Next
    End Sub
    
    If it works you can easily loop through all slides.
    www.pptalchemy.co.uk
    

    All credit to John SR Wilson!