Here's something that should get you going...
Make a new macro with a Userform (called frm1) that contains a Textbox (called txt1) and a Command Button (called cmd1). Paste the below code into the Userform code.
Ken
Private Sub cmd1_Click()
Dim strConfigName() As String Dim intArrayCount As Integer Dim intCount As Integer
intArrayCount = 1 ReDim strConfigName(intArrayCount) For intCount = 1 To Len(frm1.txt1.Text)
'Current character ASCII code if interested 'You'll need this to check for invalid characters (if there are any?), ' or maybe this could be better used in the txt1_KeyDown Event to ' disallow the invalid character from even being entered (if needed). Debug.Print Asc(Mid$(frm1.txt1.Text, intCount, 1))
If Asc(Mid$(frm1.txt1.Text, intCount, 1)) = 13 Then '13 is the Enter Key 'Ignore this character and increment configuration name array if needed If strConfigName(intArrayCount) "" Then intArrayCount = intArrayCount + 1 ReDim Preserve strConfigName(intArrayCount) End If ElseIf Asc(Mid$(frm1.txt1.Text, intCount, 1)) = 10 Then '10 is the Line Feed 'Ignore this character and increment configuration name array if needed If strConfigName(intArrayCount) "" Then intArrayCount = intArrayCount + 1 ReDim Preserve strConfigName(intArrayCount) End If ElseIf Mid$(frm1.txt1.Text, intCount, 1) "" Then 'Add this character to the current configuration name in the array strConfigName(intArrayCount) = strConfigName(intArrayCount) & Mid$(frm1.txt1.Text, intCount, 1) End If Next intCount
'Discard last configuration name in the array if it is blank If strConfigName(intArrayCount) = "" Then intArrayCount = intArrayCount - 1 ReDim Preserve strConfigName(intArrayCount) End If
'Display each configuration name entered For intCount = 1 To UBound(strConfigName()) MsgBox "Configuration Entered #" & intCount & ": " & strConfigName(intCount) Next intCount
End Sub
Private Sub UserForm_Initialize() frm1.txt1.EnterKeyBehavior = True frm1.txt1.MultiLine = True End Sub