K
ken23508
I have a userform with a listbox that is populated with all the files in a particular folder whenever the userform is initiated. On my computer, and on most of my clients computer's the following code works perfectly:
Private Sub UserForm_Initialize()
Dim fn As String
Set R = ThisWorkbook.Worksheets("seqlog").Range("db_sequence_log")
TextBox3.Text = Sheet10.Range("Location_Seq").Value
ChDir (Sheet10.Range("Location_Seq").Value)
fn = Dir("*.*")
'polulate sequence listbox with all files from directory in Textbox3
Do While fn <> ""
ListBox1.AddItem fn
fn = Dir()
Loop
then some more stuff,
On a couple computers, on the same network, when opening the same copy of the file from the same location, and with the same version of windows, office, excel, set up by the same it department, using the same licenses the form behaves differently. Instead of loading the files from the folder identified in the worksheet range the listbox is populated with the files in the user's mydocuments directory. This can be avoided if the file is saved after opening, without doing anything; just open the file, ctrl-s, then trigger the form and it works.
Any ideas about what could be different? What have I missed?
thanks
Ken
Private Sub UserForm_Initialize()
Dim fn As String
Set R = ThisWorkbook.Worksheets("seqlog").Range("db_sequence_log")
TextBox3.Text = Sheet10.Range("Location_Seq").Value
ChDir (Sheet10.Range("Location_Seq").Value)
fn = Dir("*.*")
'polulate sequence listbox with all files from directory in Textbox3
Do While fn <> ""
ListBox1.AddItem fn
fn = Dir()
Loop
then some more stuff,
On a couple computers, on the same network, when opening the same copy of the file from the same location, and with the same version of windows, office, excel, set up by the same it department, using the same licenses the form behaves differently. Instead of loading the files from the folder identified in the worksheet range the listbox is populated with the files in the user's mydocuments directory. This can be avoided if the file is saved after opening, without doing anything; just open the file, ctrl-s, then trigger the form and it works.
Any ideas about what could be different? What have I missed?
thanks
Ken