Excel VBA7 Run-time error '453': Can't find DLL entry point GetUnits in

36 Views Asked by At

I'm calling one of the many functions from a DLL using this code:

Declare PtrSafe Function GetUnits Lib "C:\Users\svd.dll" () As String

and I'm using the function with following code:

Function GetTempUnits() As String
    Dim UnitStr As String
    Dim RetStr As String
    
    ' Call the GetUnits method on the SporlanObject instance
    UnitStr = GetUnits()

    ' Based on the first character of the returned string, determine the temperature unit
    Select Case Asc(Mid$(UnitStr, 1, 1))
        Case 1
            RetStr = "°F"
        Case 2
            RetStr = "°C"
        Case 3
            RetStr = "°R"
        Case 4
            RetStr = "K"
        Case Else
            RetStr = "Unknown"
    End Select

    GetTempUnits = RetStr
End Function
0

There are 0 best solutions below