I've written an Excel module to convert latitude/longitude to UTM coordinates. The main procedure is a sub that defines the arguments and calls the function that in turn calls a DLL function. The idea is the function opens the function argument window for the user to provide the data (function is defined in another sub with Application.MacroOptions).
Sub GeoToTM()
'Declare variables
Dim TM() As Variant
Dim Lat As Double
Dim Lon As Double
Dim TMProj As Integer
Dim Ellipsoid As Integer
'Call Excel function
TM = GeoConv(Lat, Lon, TMProj, Ellipsoid)
End Sub
'VBA function wrapper
Function GeoConv(Lat, Lon, TMProj, Ellipsoid) As Variant
Dim East As Double
Dim North As Double
Dim locTM(1 To 2) As Variant
'Call C++ function
GeodeticToTM Lat, Lon, TMProj, Ellipsoid, East, North
locTM(1) = East: locTM(2) = North
GeoConv = locTM
End Function
The function on its own performs as advertised but when I run the entire module the function is accessed but the function argument window does not appear; the arguments are never populated so the function returns zeros.
How do I get this to work? Is "Option" arguments the trick here?
Thanks,
Chris