I figured out what my problem was
Private Sub Command1_Click()
Dim Mypos, Myfile
Myfile = "" '''Clear File Name
With CommonDialog1
List1.Clear
.FileName = ""
.InitDir = Trim(UploadFile)
.Flags = cdlOFNExplorer Or cdlOFNAllowMultiselect Or cdlOFNHideReadOnly
.Filter = "All files (*.*)|*.*|Text files (*.txt)|*.txt|"
.ShowOpen '''Open Dialog box to pick files
On Error GoTo ErrorHandler
Myfile = Mid(.FileName, InStrRev(.FileName, "\") + 1) '''Get File Name
iCounter = 1
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''Routine if a single file was selected''''''''''''''''''''''''''''''''''''
If InStr(1, Myfile, vbNullChar) = 0 Then '''Check to see if NullChar exists
Myfile = vbNullChar & Myfile '''Put NullChar before file name
.FileName = Dir1 & Myfile '''Plug new filename
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''Routine to Seperate Files''''''''''''''''''''''''''''''''''''''''''''''''
sFolder = Mid(.FileName, 1, InStr(iCounter, .FileName, vbNullChar) - 1) 'Pull Original Path Name
Do Until InStr(iCounter + 1, .FileName, vbNullChar) = 0 'Pull filenames until there are no more
iCounter = InStr(iCounter + 1, .FileName, vbNullChar) + 1
If InStr(iCounter, .FileName, vbNullChar) = 0 Then
List1.AddItem Mid(.FileName, iCounter)
Else
List1.AddItem Mid(.FileName, iCounter, InStr(iCounter + 1, .FileName, vbNullChar) - iCounter)
End If
Loop
If iCounter > 0 Then '''Find out if they picked any files
Label1.Caption = "Here are the file(s) you have selected to upload, if this is not correct please choose the correct file(s). If the file(s) are correct Press OK."
Label1.Visible = True
List1.Visible = True
OK1.Visible = True
Cancel1.Visible = True
Line1.Visible = True
Else
End If
End With
iCounter = 0
Exit Sub
ErrorHandler: ''Error Handeling Routine if the file is not found.
Select Case Err.Number
Case 5 ''No file was selected to upload
OK1.Visible = False
Cancel1.Visible = False
Line1.Visible = False
Label1.Visible = False
List1.Visible = False
MsgBox "Please Select File(s) to be Uploaded."
Err.Clear
Case Else
'MsgBox Err.Number, Err.HelpFile, Err.HelpContext
MsgBox Err.Description
Err.Clear
Resume Next
End
End Select
End Sub