|






|
Question
| From: |
BlackHawk |
| Date: |
02-02-02 12:04 |
| Subject: |
Can't seem to find examples of Text/file path... |
| Question: |
I am trying to do the following:
1) Browse to a directory.
2) Upon clicking a command buton Extract the path of all tiff/tif files in that are contained in that direcotry and then output that path to a text file. Each file having its own line.
Even a simple example of how to create/open/save and close a text file would be helpful. If you have any suggestions for this newbie, please help
|
Answer by Martin Allen:
1. Create a FileListBox, a DirListBox and a DriveListBox. In the Click events on these, change the paths of the others the new location i.e. if the user clicked on another drive, the DirListBox and FileListBox would change, and if the user clicked on the DirListBox, only the FileListBox path would change.
You might also want to include some error trapping code.
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub |
Set the Pattern property of the FileListBox to *.tif*.

2. Create a button on the form with this code:
Private Sub Command1_Click()
Dim i As Long
Open "C:\windows\desktop\tif.txt" For Output As #1
For i = 0 To File1.ListCount - 1
Print #1, File1.Path & "\" & File1.List(i)
Next i
Close #1
End Sub |
When the FileListBox path is in the place you want, click on the button.
Change the filename to the one you want.
Martin Allen 1999 - 2006. Last updated Saturday 06 May 2006 06:12:43 PM +0100.
|