Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I use Windows Explorer as a control?

Status
Not open for further replies.

roswald

Programmer
Jul 6, 2002
152
0
0
US
Is there a way that I could set my path and filename by having the user click on a control that would open Windows Explorer, where they could click on the report object?

Then I could do something like...
Set Report = Application.OpenReport(mycontrol.text?)

Thanks in advance for taking the time to help!
 
The WebBrowser control can display both file system folders and special folders, but you may have trouble determining what the user clicked on.

The only thing I can think of for this situation is the common dialog control. You should make sure to set the Flags property to verify filenames, and hide the read-only checkbox if your program doesn't support a read-only "mode" that is different from the way it normally operates.
 
I believe what you're referring to is the Windows Common Dialog Control. It allows users to browse the file system for a valid file name. You can set a filter for it so they can only select certain file types as well.

Code:
  Dim strFile As String
  
  With CommonDialog1
    .Filter = "Report Files (*.rpt)|*.rpt"   
    .ShowOpen
    strFile = .FileName
  End With

  MsgBox "You selected " & strFile
VBSlammer
redinvader3walking.gif

Unemployed in Houston, Texas
 
Dear vbslammer,
Thank you for the code snipett along with the information.
This is exactly what I was looking for and the app works great.
By taking a couple of minutes to email me, it saved me hours valuable time. I really appreciate it.

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top