G
Guest
I am using the followin code to fill a comboBox with the names of csv files
found in a folder. I use the comboBox to select a file to transfer into a
table. After desplaying the data in the file and saving it into other
tables, i delete the original file with the Kill function. I then set the
combobox rowsource to "" and call this procedure again. The problem is that
the file.csv that I looked at and then Killed still showes up in the combobox
again. A check if the directory confirms that it is gone, but i cand keep
the name out of my combobox. (MyPath is a public string)
Private Sub LoadCombBox()
Dim id As String
Dim x As Integer
With Application.FileSearch
'.NewSearch
.LookIn = myPath
.FileName = "*.csv"
If .Execute > 0 Then
For x = 1 To .FoundFiles.Count
id = .FoundFiles(x)
id = Replace(id, myPath, "")
id = Replace(id, ".csv", "")
Me.GRNName.AddItem id
Next x
Else
MsgBox "No New Chem Results Found"
stopCmd_Click
End If
End With
End Sub
found in a folder. I use the comboBox to select a file to transfer into a
table. After desplaying the data in the file and saving it into other
tables, i delete the original file with the Kill function. I then set the
combobox rowsource to "" and call this procedure again. The problem is that
the file.csv that I looked at and then Killed still showes up in the combobox
again. A check if the directory confirms that it is gone, but i cand keep
the name out of my combobox. (MyPath is a public string)
Private Sub LoadCombBox()
Dim id As String
Dim x As Integer
With Application.FileSearch
'.NewSearch
.LookIn = myPath
.FileName = "*.csv"
If .Execute > 0 Then
For x = 1 To .FoundFiles.Count
id = .FoundFiles(x)
id = Replace(id, myPath, "")
id = Replace(id, ".csv", "")
Me.GRNName.AddItem id
Next x
Else
MsgBox "No New Chem Results Found"
stopCmd_Click
End If
End With
End Sub