Option Explicit
Dim FechaNatal As String * 10 'Text1
Dim sDIA As String * 2
Dim DIA As Byte
Dim sMES As String * 2
Dim MES As Byte
Dim sAÑO As String * 4
Dim AÑO As Integer
' ----------------
Dim HoraNatal As String * 8 'Text2
Dim sHORA As String * 2
Dim HORA As Byte
Dim sMIN As String * 2
Dim MIN As Byte
Dim sSEG As String * 2
Dim SEG As Byte
Dim HoraNatalD As Double
' ----------------------
Dim TAV As String * 6 'Text3
Dim sHoraTAV As String * 3
Dim HoraTAV As Integer
Dim sMinTAV As String * 2
Dim MinTAV As Byte
Dim TAVD As Single
' ----------------
Dim CiudadNatal As String 'Text4
' -----------------------
Dim LongitudNatal As String * 9 'Text5
Dim LongGra As Byte
Dim LongMin As Byte
Dim LongSeg As Byte
Dim LongitudNatalD As Double
' --------------------------
Dim LatitudNatal As String * 8 'Text6
Dim LatGra As Byte
Dim LatMin As Byte
Dim LatSeg As Byte
Dim LatitudNatalD As Double
' ----------------
Dim GMT As Single
Dim HoraGMT As Byte
Dim MinGMT As Byte
Dim SegGMT As Byte
Dim GMTD As Double
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
End Sub
Private Sub Text1_Change()
If Text1.Text = "" Then
MsgBox ("Poner la Fecha Natal en DD/MM/AAAA")
End If
FechaNatal = Text1.Text
' ------ FECHA NATAL -------
sDIA = Left(FechaNatal, 2)
DIA = Val(sDIA)
sMES = Mid(FechaNatal, 4, 2)
MES = Val(sMES)
sAÑO = Right(FechaNatal, 4)
AÑO = Val(sAÑO)
Label7.Caption = DIA & "/" & MES & "/" & AÑO
End Sub
Private Sub Text2_Change()
HoraNatal = Text2.Text
' --------- HORA NATAL ----------
sHORA = Left(HoraNatal, 2)
HORA = Val(sHORA)
sMIN = Mid(HoraNatal, 4, 2)
MIN = Val(sMIN)
sSEG = Right(HoraNatal, 2)
SEG = Val(sSEG)
If HORA >= 24 Then
MsgBox ("Pon la Hora Natal de 0 a 23 Horas")
End If
Label8.Caption = HORA
Label9.Caption = MIN
Label10.Caption = SEG
HoraNatalD = ((((SEG / 60) + MIN) / 60) + HORA) 'HoraNatal en Decimal
'La Fórmula es correcta y los resultados
Label11.Caption = HoraNatalD
End Sub
Private Sub Text3_Change()
If Text3.Text = "" Then
MsgBox ("Pon las Horas de TAV en +- HH:MM")
End If
TAV = Text3.Text
' ---------- TAV ----------
sHoraTAV = (Left(TAV, 3))
HoraTAV = Val(sHoraTAV)
sMinTAV = (Right(TAV, 2))
MinTAV = Val(sMinTAV)
Let HoraTAV = CSng(HoraTAV)
'Let MinTAV = CSng(MinTAV)
'Da igual que incluya el cambio de minutos o no.
'Si es positivo, es correcto.
'Si es positivo, es correcto incluso con minutos.
'Si es negativo y no tiene minutos, correcto.
'si es negativo, resta los minutos que le ponga en proporciones.
Label12.Caption = sHoraTAV
Label13.Caption = sMinTAV
TAVD = (MinTAV / 60) + HoraTAV
Label14.Caption = HoraTAV
Label15.Caption = TAVD
'La Fórmula es correcta y los resultados
End Sub