Search Folder for Files
That works great, cheers. Unfortunatly I've had trouble applying this to what
i'm doing
Private Sub Find_files()
Dim strPath As String
Dim colFiles As New Collection
Dim strFile As String
Dim i As Integer
Dim month As Variant
Dim year As Variant
year = ComboBox1.Value
month = ComboBox2.Value
strPath = "S:\MANAGEMENT INFORMATION\" & year & "\" & month & "\"
strFile = Dir(strPath)
Do While strFile < ""
colFiles.Add strFile
strFile = Dir
Loop
CommandButton1.Caption = colFiles(1)
End Sub
with message boxes i've sorted the year/month thing so I know that works.
But the last line about changing the commandbutton caption throws up an error
when initialized (opening the userform triggers the macro after setting up
the combobox values)
I was assuming setting the command buttons to open the files to be harder
then just changing the captions :/
|