Solved

VB6 - Browse to file

Posted on 2009-04-07
5
678 Views
Last Modified: 2012-05-06
I wanted to know if theres a way to browse to a file using a button in VB6.

For example:

I have a string that goes to "C:\foldername\test.txt".. I hit the browse button to go to that file, which should open the explorer and browse to that file, basicly.

How could this be possible for VB6? Thanks!

0
Comment
Question by:Valleriani
  • 3
5 Comments
 
LVL 7

Expert Comment

by:cmrobertson
ID: 24092324
0
 
LVL 7

Author Comment

by:Valleriani
ID: 24092436
I'm confused here. Isn't common dialog for opening and saving files?

What I'm aiming to do is when a file is created via my program, I want a browse button so they can hit the button, and it will open up explorer and point to the file, much like when you download a file from the internet, I think FF and opera have it, where you can right click it and 'browse to file' and it will open explorer to the file, ready to be opened or deleted, whatever you want really.
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 24092516
Sure...see: http://support.microsoft.com/default.aspx?scid=kb;EN-US;q152457
Private somePath As String
 
Private Sub Command1_Click()
    somePath = "C:\foldername\test.txt"
    Shell "explorer /select," & somePath, vbNormalFocus
End Sub

Open in new window

0
 
LVL 7

Author Comment

by:Valleriani
ID: 24092605
Bloody hell, that easy... Thanks, worked great!
0
 
LVL 7

Author Closing Comment

by:Valleriani
ID: 31567782
Simple!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question