open windows explorer with command button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I need a simple way to open windows explorer by
clicking on a command button. Can anyone help?

I am real new to using Access to call other Office products.

Thanks,
 
You can use the shell program or the Followhyperlink by giving a page you
want to open

application.FollowHyperlink "http:\www.google.com"

x=Shell("C:\Program Files\Internet Explorer\iexplore.exe")
 
To open Windows Explorer use the following code:
Shell "explorer " & myFolderPath, vbNormalFocus

and you can set myFolderPath variable to the specific folder (do not forget
to wrap it up in double quotes (Chr(34)) if path contains spaces)

HTH
 
I tried " Shell "explorer " & myFolderPath, vbNormalFocud ", I get an error
that says "Bad file name or Number".

The folder path is good, I double checked it.

I even tried using " intWinExplr = shell( strFolderPath,vbNormalFocus) " where
the text "explorer " is added to the beginning of myFolderPath,

I still had the same message returned.

What's up?
 
try to experiment within your command prompt. Firstly type something obvious,
like

explorer c:\

then

explorer "C:\Program Files\Microsoft Office"

this should work as long as your enviroment Path variable is correct. And
then make sure that the string you pass to shell function is exactly the same
string as you use in your command prompt.
 
Back
Top