Hello,
I have a combo box that displays all the files in a specific directory. Below is the On Load event for the form that makes the combo box work (found this by a search, thanks to whoever that was). After they choose the file they want to work with, I have a button to do the import of the file and then I move the file out of that directory. I want the combo box to update at the end of this procedure to only show the files left in the directory. I searched on this and found a few things, such as put the code on the On Activated event, but this just causes the files left in the directory to append to the list that was already showing up. I tried moving it a few different places, like at the end of events on the button for the import, but everything I've tried just tacks on the new list to the end of the old list. Any ideas how to make the combo box update to only show the files that are actually in the directory after I move the file being worked with?
Dim FSO As Object, fld As Object, Fil As Object
Dim SubFolderName As String
Dim i As Integer
Set FSO = CreateObject("Scripting.FileSystemObject")
SubFolderName = "\\cinfile01\custom solution\"
Set fld = FSO.GetFolder(SubFolderName)
For Each Fil In fld.files
i = i + 1
Me.FileComboBox.AddItem Fil.Name
Next Fil
Thanks for any help!
Stacey
I have a combo box that displays all the files in a specific directory. Below is the On Load event for the form that makes the combo box work (found this by a search, thanks to whoever that was). After they choose the file they want to work with, I have a button to do the import of the file and then I move the file out of that directory. I want the combo box to update at the end of this procedure to only show the files left in the directory. I searched on this and found a few things, such as put the code on the On Activated event, but this just causes the files left in the directory to append to the list that was already showing up. I tried moving it a few different places, like at the end of events on the button for the import, but everything I've tried just tacks on the new list to the end of the old list. Any ideas how to make the combo box update to only show the files that are actually in the directory after I move the file being worked with?
Dim FSO As Object, fld As Object, Fil As Object
Dim SubFolderName As String
Dim i As Integer
Set FSO = CreateObject("Scripting.FileSystemObject")
SubFolderName = "\\cinfile01\custom solution\"
Set fld = FSO.GetFolder(SubFolderName)
For Each Fil In fld.files
i = i + 1
Me.FileComboBox.AddItem Fil.Name
Next Fil
Thanks for any help!
Stacey