试试这个:
Option Explicit
''''''''''将度转化程度分秒''''
Private Function DegreeToDMS( _
strDegree As String _
) As Double
Dim Msg As String
Dim V1 As Double
Dim V2 As Double
Dim V3 As Double
Dim i As Integer
Dim j As Integer
Dim L As Integer
Dim Temp As String
Dim Temp1 As String
Dim Temp2 As String
Dim Temp3 As String
Msg = strDegree
L = Len(Msg)
' V1 = Val(Msg)
For i = 1 To L
Temp = Mid$(Msg, i, 1)
If Temp = "°" Then
Temp1 = Mid$(Msg, 1, i - 1)
j = i + 1
ElseIf Temp = "'" Then
Temp2 = Mid$(Msg, j, i - 1)
Temp3 = Mid$(Msg, i + 1, L)
Exit For
Else
End If
Next
V1 = Val(Temp1)
V2 = Val(Temp2) / 60
V3 = Val(Temp3) / 3600
DegreeToDMS = V1 + V2 + V3
End Function
Private Sub Command1_Click()
Text2 = DegreeToDMS(Text1)
End Sub
[此贴子已经被作者于2007-2-8 21:06:55编辑过]