How To Use Petroleum Office Addin Functions From VBA

Use Application.Run to call any Petroleum Office function from VBA. The first argument is the function name, followed by the function parameters.

Public Function UnitConverterVBA(A As Double, B As String, C As String)
    UnitConverterVBA = Application.Run("PO.UnitConverter", A, B, C)
End Function

Application.Run converts Excel COM data types (Ranges, variants, arrays) to the appropriate types before calling the add-in function, and converts the result back to a COM Variant.

An unhandled error has occurred. Reload X