hi,
i need know how can i open a folder and select a file that is inside of that folder
like windows does when we choose a option to locate a shorcut file
thanks a lot for your help
:)
Printable View
hi,
i need know how can i open a folder and select a file that is inside of that folder
like windows does when we choose a option to locate a shorcut file
thanks a lot for your help
:)
You could use the command line switches in the explorer. Something like this should workCode:Dim filePath As String
filePath = "C:\Folder\FileName.txt"
Shell "Explorer /select," & Chr(34) & filePath & Chr(34), vbMaximizedFocus
No, I think what you seek is the CommonDialog control.
Add 'Microsoft CommonDialog Control 6.0' to your toolbox and put one on your form.
It allows to create a FileOpen dialog like windows uses to allow for the selection of a file somewhere on a drive.
If you need to know more details, CommonDialog is described in the VB online manual.
The most simple usage:
Put a CommonDialog on a form. Name it "cdlg"
In a button put the code: cdlg.ShowOpen to see if that's what you wanted.
You can walk through the folders and select a file, and after clicking ok it returns to your calling routine and cdlg.FileName contains the selected filename.
Very easy.
Duh!
I thought OP was talking about the select. But yes I agree, what he needs is a Common Dialog control which can be added to the control toolbox using the above procedure mentioned in post # 3.
You can also set the initial directory and one or more filters via code before you call the show open method. This way if you want them to be able to browse images only you can filter by image type or set of image types using wildcards. e.g. *.jpg *.bmp on so on