matrixindicator
IS-IT--Management
I need to feed a combobox list with not only the files (easy) but the complete url. A fixes part "D:\CTRL\ES\" and a variable part directory after this like "D:\CTRL\ES\01_09", "D:\CTRL\ES\02_09", "D:\CTRL\ES\03_09"
This works until I use a Dir to get MyFile = MyLinkToFile & Dir(MyLinkToFile & "*.*").
He represent nice the first url "D:\CTRL\ES\01_09\excel.xls" but can't go to the next map 02_09 via MyName = Dir ' Get next entry.
Finally I should get combobox values like
This works until I use a Dir to get MyFile = MyLinkToFile & Dir(MyLinkToFile & "*.*").
He represent nice the first url "D:\CTRL\ES\01_09\excel.xls" but can't go to the next map 02_09 via MyName = Dir ' Get next entry.
Code:
' Display the names in D:\ that represent directories.
MyPath = "D:\CTRL\ES\" ' Set the path.
MyName = Dir(MyPath, vbDirectory) ' Retrieve the first entry.
Do While MyName <> "" ' Start the loop.
' Ignore the current directory and the encompassing directory.
If MyName <> "." And MyName <> ".." Then
' Use bitwise comparison to make sure MyName is a directory.
If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory Then
MyLinkToFile = MyPath & MyName & "\"
MyFile = MyLinkToFile & Dir(MyLinkToFile & "*.*")
'ComboBox1.AddItem (MyLinkToFile & Dir(MyLinkToFile & "*.*"))
' Display entry only if it
End If ' it represents a directory.
End If
MyName = Dir ' Get next entry.
Loop
Finally I should get combobox values like
Code:
"D:\CTRL\ES\01_09\excel.xls"
"D:\CTRL\ES\02_09\excel.xls"
"D:\CTRL\ES\03_09\excel.xls"