Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Opening Windows Explorer

Hi Matt,

If you want to use Ron's macro then use as under.

Sub GetSpecialFolder()
Dim WshShell As Object
Dim SpecialPath As String
Set WshShell = CreateObject("WScript.Shell")
SpecialPath = WshShell.SpecialFolders("MyDocuments")
Shell "explorer.exe /e, " & SpecialPath, vbNormalFocus
End Sub


To use Environ function, use it as under.


Shell "Explorer.exe /e," & Environ("userprofile") & "\My Documents",
vbNormalFocus


Regards,
Shailesh Shah
http://in.geocities.com/shahshaileshs/
If You Can't Excel with Talent, Triumph with Effort.

http://in.geocities.com/shahshaileshs/menuaddins
(Free addins old\classic Office Menu-2003 for Office-2007)




"Shah Shailesh" wrote in message
...

What window version it is?

What you get when using Environ("userprofile") from different window
version.

Check this function as under from vba code module or debug window.

msgbox Environ("userprofile")

or

debug.print Environ("userprofile")


From your error message you can try as under only for your Window Version.

Shell "Explorer.exe /e," & Mid(Environ(27), 20) & "\My Documents",
vbNormalFocus


I suggest this because user may have installed windows other then C drive
and it depends upon User Profile and also Window Version for the path of
My Document.



Regards,
Shailesh Shah
http://in.geocities.com/shahshaileshs/
(Free addins Office Menu-2003 for Office-2007)



"Launchnet via OfficeKB.com" <u20911@uwe wrote in message
news:76ef3dc755c9d@uwe...
Hi Shah . . .

Tried, but I get the following error message: The path 'TATION2\My
Documents' does not exist or is not a directory.

Matt

Shah Shailesh wrote:
Try this,

Shell "Explorer.exe /e," & Mid(Environ(27), 13) & "\My Documents",
vbNormalFocus

This should work regardless of Path of Explorer & My document for Window
XP.

Regards,
Shailesh Shah
http://in.geocities.com/shahshaileshs/
(Free addins Office Menu-2003 for Office-2007)

The Below Macro Works, but I need a Macro that will open Windows
Explorer
from Excel, displaying My Documents regardless of what Path Explorer is
[quoted text clipped - 14 lines]
Thanks
Matt


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200708/1





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creates new file when opening in windows explorer fund_dan Excel Discussion (Misc queries) 4 December 27th 07 08:23 PM
File Open Vs Opening from Windows Explorer [email protected] Excel Discussion (Misc queries) 0 September 7th 07 10:15 AM
Shell function for opening windows explorer racudd[_3_] Excel Programming 3 July 11th 06 12:53 AM
Opening Windows Explorer... Timmy Mac1[_7_] Excel Programming 1 May 15th 06 12:42 PM
Opening Excel workbooks from Windows Explorer R Ormerod Excel Discussion (Misc queries) 2 April 1st 06 12:44 PM


All times are GMT +1. The time now is 07:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"