Hi guys,
Here's what it became finally. Take notice of the bOk lines thanks to a Dutch helper. If the code is OK it tells the cursor to move on, if not the cursor remains in the field.
Option Explicit
Public bOk As Boolean
Private Sub TxtPostcd_AfterUpdate()
Dim pc As String
bOk = True
If TxtPostcd.Text = "" Then Exit Sub
pc = UCase(Replace(TxtPostcd.Text, " ", ""))
If Not pc Like "####[A-Z][A-Z]" Or Len(pc) <> 6 Then 'check op lengte en op opmaak
bOk = False
MsgBox "Ongeldige invoer" & vbCrLf & "" & vbCrLf & "Probeer opnieuw", vbOKOnly
TxtPostcd.Text = ""
Exit Sub
End If
pc = Left(pc, 4) & " " & Right(pc, 2)
If pc <> TxtPostcd.Text Then TxtPostcd.Text = pc
End Sub
Private Sub txtPostcd_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Not bOk Then Cancel = True
End Sub
Private Sub userform_click()
End Sub