Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Creates new file when opening in windows explorer | Excel Discussion (Misc queries) | |||
File Open Vs Opening from Windows Explorer | Excel Discussion (Misc queries) | |||
Shell function for opening windows explorer | Excel Programming | |||
Opening Windows Explorer... | Excel Programming | |||
Opening Excel workbooks from Windows Explorer | Excel Discussion (Misc queries) |