ich habe in einen Userform 2 Datumsfelder eingebaut, welche ich
in Abhängigkeit von einander berechne.
Dazu erstmal der Code:
Private Sub Textbox22_AfterUpdate()
Dim dagwert As Date
Dim Check_Date As Boolean
If UserForm1.TextBox22.value "" Then
On Error GoTo ErrHandler:
dagwert = Format(CDate(UserForm1.TextBox22.value), "dd.mm.yyyy")
'Exit Sub
If IsDate(dagwert) = True Then
dagwert = Format(TextBox22, "short date")
Check_Date = True
Else
Check_Date = False
End If
'Dim datevalue As Date
Dim Cancel As Boolean
'datevalue = TextBox22.Value
If Check_Date = False Then
MsgBox TranslateString("Geben Sie ein gültiges Datum im Format dd.mm.yyyy ein", " _
msg202", "GLOBAL"), vbCritical
UserForm1.TextBox22 = ""
Cancel = True
Else
TextBox16.value = Format(dagwert + 365, "mmmm") + " " + Format(dagwert + 365, "yyyy" _
)
If UserForm1.CheckBox3.value = True Then ' And TextBox24.Value = "" Then
TextBox24.value = dagwert
TextBox23.value = Format(dagwert + 365, "mmmm") + " " + Format(dagwert + 365, "yyyy" _
)
End If
If UserForm1.CheckBox4.value = True Then ' And TextBox13.Value = "" Then
TextBox24.value = dagwert
TextBox23.value = Format(dagwert + 365, "mmmm") + " " + Format(dagwert + 365, "yyyy" _
)
End If
End If
End If
Exit Sub
ErrHandler:
' error handling code
MsgBox TranslateString("Geben Sie ein gültiges Datum im Format dd.mm.yyyy ein", "msg202", " _
_
GLOBAL"), vbCritical
Resume Next
End Sub
Der Code Funktioniert soweit, nur bei eine Englischen Betriebssystem komme ich so nicht weiter, da ja hier das Format MM/DD/YYYY ist.
Wie kann ich soetwas umgehen oder anders lösen?
Gruss Dirk