I have a problem with join Arrays.


Thanks for help.


Option Compare Text

Private Sub Form_Load()
Dim RegCatValue As String, FileCatValue As String, ldFile As String
Dim FF As Integer: FF = FreeFile
Dim tmp1Array() As String
Dim tmp2Array() As String
Dim tmpAll() As String


Dim I As Integer


'On Error GoTo ErrorHandler

ldFile = App.Path & "\NewCategories"


'Schlüssel aus der Registry lesen
RegCatValue = GetString(HKEY_CURRENT_USER, "Software\Microsoft\Office\9.0\Outlook\Categories", "MasterList")


'Schlüssel aus der Datei "NewCategories" lesen
Open ldFile For Input As #FF
Do While Not EOF(1)
Line Input #FF, FileCatValue
Label2.Caption = FileCatValue
Loop
Close #FF


'Schlüssel anzeigen
Label1.Caption = "Werte aus Registrierung: " & RegCatValue
Label2.Caption = "Werte aus Datei: " & FileCatValue


'Schlüssel vergleichen
If (RegCatValue = FileCatValue) Then
'do something
MsgBox ("Gleich")
Else

Label2.ForeColor = RGB(255, 0, 0)

tmp1Array() = Split(RegCatValue, ";", , vbTextCompare)
tmp2Array() = Split(FileCatValue, ";", , vbTextCompare)

For I = 0 To UBound(tmp1Array)
If Right(tmp1Array(I), 1) = "" Then '//check for unwanted symbols like ,. etc
MsgBox ("Nichts gefunden")
Else
If Left(tmp1Array(I), 1) = "-" Then

'tmp2Array = Join((tmp1Array(I)), "-")
Else
End If
End If
Next I
End If

tmp2All = Join(tmp1Array(tmp2Array(RegCatValue, FileCatValue)))

Label3.Caption = "Alle Kategorie: " & "" & tmp2All



Exit Sub

ErrorHandler:
MsgBox ("Pfadangaben für die Empfängerdatei überprüfen !"), vbExclamation
End Sub