PDA

View Full Version : Solved: Reset path in listbox



lucas
01-18-2006, 09:39 AM
I have a "Listfiles" Document that I have been using for some time for file transfer to clients as a transmittal document. It originally opens to the system drives and I was trying to change that to open to a specific directory to save some time. I have been struggling with this for a week now and thought I would ask for some help..

Original code in the PopListbox module to set the path....

If Not oFileSysObj.FolderExists(txtPath.Text) Then 'if no such folder
txtPath.Text = ""

For Each oDrive In oFileSysObj.Drives 'list drives
lstFolders.AddItem oDrive.DriveLetter & ":"
Next


Changes I have made that work in the cmdUpLevel window but not in the listbox....that is to say that the subfolders get listed in the listbox but you cannot double click on them until you go up one level and then work back down...what am I missing?

I replaced the above code with this to get to where I am now:
you will have to change the path below to a directory on your system

If Not oFileSysObj.FolderExists(txtPath.Text) Then 'if no such folder
txtPath.Text = "G:DocumentsLucas EntCAD JobsBC Steel"

Set oFolder = oFileSysObj.GetFolder(txtPath.Text)

For Each oSubFolder In oFolder.subfolders
lstFolders.AddItem oSubFolder.Name 'add each subfolder
Next


My current file attached for clarity. Any insights would be appreciated.

lucas
01-19-2006, 08:15 PM
I finally got this to work for me....solution for anyone that might be interested:

txtPath.Text = "G:\Documents\Lucas Ent\CAD Jobs\BC Steel" & lstFolders.Text & "\"