Option Explicit
Function DegrésDe(ByVal Txt As String) As Double
DegrésDe = DegrésTxt(Txt)
End Function
Function Latitude(ByVal Deg As Double) As String
Latitude = "N": DegrésTxt(Latitude) = Deg
End Function
Function Longitude(ByVal Deg As Double) As String
Longitude = "E": DegrésTxt(Longitude) = Deg
End Function
Property Get DegrésTxt(Txt As String) As Double
Dim Sens As Integer, Signe As Integer, D As Long, M As Long, S As Long, Ts() As String
Lettre(Sens, Signe) = Txt
Ts = Split(Txt, "°"): D = Ts(0)
Ts = Split(Ts(1), "’"): M = Ts(0)
Ts = Split(Ts(1), "”"): S = Ts(0)
DegrésTxt = (D + (M + S / 60) / 60) * Signe
End Property
Property Let DegrésTxt(Txt As String, ByVal Deg As Double)
Dim Sens As Integer, Signe As Integer, D As Long, M As Long, S As Long
Lettre(Sens, Signe) = Txt: Signe = Sgn(Deg): Deg = Abs(Deg)
D = Int(Deg): M = Int(60 * (Deg - D))
Deg = 60 * (Deg - D): M = Int(Deg)
Deg = 60 * (Deg - M): S = Round(Deg)
Txt = D & "° " & M & "’ " & S & "” " & Lettre(Sens, Signe)
End Property
Private Property Get Lettre(Sens As Integer, Signe As Integer) As String
Lettre = Mid$("NESO", Sens - Signe, 1)
End Property
Private Property Let Lettre(Sens As Integer, Signe As Integer, ByVal Lt As String)
Sens = InStr("NESO", Right$(Lt, 1))
Signe = 1 - (Sens - 1 And 2)
Sens = Sens + Signe
End Property