By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,509 Members | 1,686 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,509 IT Pros & Developers. It's quick & easy.

Using call shell to open a specified folder

P: 4
Hi
Am using
Expand|Select|Wrap|Line Numbers
  1. Call Shell("explorer.exe c:\", vbNormalFocus)
this works fine however i have the folder location stored in a txt field and would like the button to retrieve that location

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdShortcut_Click()
  2.     Dim strShortcut As String
  3.     strShortcut = Me.txtShortcut
  4.  
  5.     Call Shell("explorer.exe" & strShortcut, vbNormalFocus)
  6. End Sub
tried this but not working, says path not found although copy pasting the path works.
I tried to use hyperlinks and they didnt work either.
any ideas greatly appreciated. j
Jan 4 '07 #1
Share this Question
Share on Google+
4 Replies


P: 4
just to clarify the path i copy and paste is the one in "txtshortcut"
Jan 4 '07 #2

ADezii
Expert 5K+
P: 8,601
Hi
Am using
Expand|Select|Wrap|Line Numbers
  1. Call Shell("explorer.exe c:\", vbNormalFocus)
this works fine however i have the folder location stored in a txt field and would like the button to retrieve that location

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdShortcut_Click()
  2.     Dim strShortcut As String
  3.     strShortcut = Me.txtShortcut
  4.  
  5.     Call Shell("explorer.exe" & strShortcut, vbNormalFocus)
  6. End Sub
tried this but not working, says path not found although copy pasting the path works.
I tried to use hyperlinks and they didnt work either.
any ideas greatly appreciated. j
This will work fine, you simply needed a space after explorer.exe:
Expand|Select|Wrap|Line Numbers
  1. Dim retVal
  2. retVal = Shell("explorer.exe " & Me![txtShortcut], vbNormalFocus)
Jan 4 '07 #3

P: 4
Cheers! i feel so stupid now!
Thanks again
Jan 5 '07 #4

NeoPa
Expert Mod 15k+
P: 31,186
LMAO.
But we've all done that Jonni.
The important thing is that you're sorted :)
Jan 7 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.