Property or method not found: getEmbeddedObjects.

I am trying to run the code below on a presentation containing equations, but I get the following error:

BASIC runtime error.
Property or method not found: getEmbeddedObjects.

I don’t know why it is not being found - any ideas? Thanks.

REM  *****  BASIC  *****
Sub ReformatFormulas
    embeddedObjects = ThisComponent.getEmbeddedObjects()
    elementNames = embeddedObjects.getElementNames()
    for i=0 to UBOUND(elementNames)
        element = embeddedObjects.getByName(elementNames(i)).Model
        oXEO = embeddedObjects.getByName(elementNames(i)).ExtendedControlOverEmbeddedObject
        iCurrentState = oXEO.currentState
        oXEO.changeState(com.sun.star.embed.EmbedStates.UI_ACTIVE)
        if (not isNull(element)) then
            if (element.supportsService("com.sun.star.formula.FormulaProperties")) then
                element.BaseFontHeight = 10
                element.FontNameVariables= "Times New Roman"
                element.FontVariablesIsItalic=1
                element.FontNameFunctions = "Times New Roman"     
                element.FontNameNumbers= "Times New Roman"        
                element.FontNameText= "Times New Roman"       
            endif
        endif
    next i
End Sub

Edited for clarity. Please use preformatted text icon on toolbar for this.