This topic is locked

Convert VBA (Excel) to VBS for ASPRunner

7/21/2008 8:01:55 PM
ASPRunnerPro General questions
P
PatrickK64 author

THIS WAS RESOLVED. (Topic 9393)
I have a snippet of VBA that I'd like to see how I would convert to VBS for ASPRunner.

I am new to VB and ASP, so I'm a bit lost with this.
What would a function like this look like in ASP?
Public Function DegToMinSec(DecDeg)

' Converts position field from decimal degrees to degrees.minutesseconds

' specified as degmmss ( (e.g., converts 36.97611 to 365834 )

xDecDeg = Abs(DecDeg)

Ideg = Int(xDecDeg)

Decim = xDecDeg - Ideg

imin = Int(Decim 60)

isec = Int((Decim
60 - imin) 60 + 0.5)

DegToMinSec = Ideg
10000 + imin * 100 + isec

End Function
Let's say the input field is Decimal Latitude and the output will be to

the field Degrees Latitude. These fields need to perform the calculation automatically

whenever an entry occurs. Or in the case of the edit page, whenever a changed value occurs.
I'm confused and could use some guidance with this, so I can convert the rest of the functions.
Thanks a lot.
-Pat

J
Jane 7/22/2008

Patrick,
VBA and ASP code are not 100% compatible.
For example Int() function in VBA translates into CInt() function in ASP.

You need to modify VBA code to make it work in ASP.
Then you can add these functions to the commonfunctions.asp file and use it in the ASPRunnerPro events on the Events tab.