special folders: references for Shell Controls

A

Allen_N

I tried to implement the example in
'http://www.microsoft.com/technet/scriptcenter/guide/sas_fil_higv.mspx?mfr=true
to get the 'My Documents' and 'Desktop' folders, but Excel doesn't like the
'.Self' property of the 'Folder' object.

The references to add were given in
'http://msdn.microsoft.com/library/d...basics/shell_basics_programming/objectmap.asp' as:

Microsoft Internet Controls (SHDocVw)
Microsoft Shell Controls and Automation (Shell32)

but the 1st one isn't listed in the available references in my Excel 2003,
and adding the 2nd reference didn't fix my problem.

Does anyone know what these references should be for Windows XP?
 
B

Bob Phillips

Const wsh_SPECIAL_FOLDER_DESKTOP = 10
Const wsh_SPECIAL_FOLDER_MY_DOCS As Long = 16
Dim oWSH As Object

Set oWSH = CreateObject("WScript.Shell")

MsgBox oWSH.SpecialFolders(wsh_SPECIAL_FOLDER_DESKTOP)

MsgBox oWSH.SpecialFolders(wsh_SPECIAL_FOLDER_MY_DOCS)


--
HTH

Bob Phillips

(there's no email, no snail mail, but somewhere should be gmail in my addy)

Allen_N said:
I tried to implement the example in
'http://www.microsoft.com/technet/scriptcenter/guide/sas_fil_higv.mspx?mfr=t
rue
to get the 'My Documents' and 'Desktop' folders, but Excel doesn't like the
'.Self' property of the 'Folder' object.

The references to add were given in
'http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/pl
atform/shell/programmersguide/shell_basics/shell_basics_programming/objectma
p.asp' as:
 
R

Ron de Bruin

Maybe this will help

Sub GetSpecialFolder()
'Special folders are : AllUsersDesktop, AllUsersStartMenu
'AllUsersPrograms, AllUsersStartup, Desktop, Favorites
'Fonts, MyDocuments, NetHood, PrintHood, Programs, Recent
'SendTo, StartMenu, Startup, Templates

'Get Favorites folder and open it
Dim WshShell As Object
Dim SpecialPath As String

Set WshShell = CreateObject("WScript.Shell")
SpecialPath = WshShell.SpecialFolders("Favorites")
MsgBox SpecialPath
'Open folder in Explorer
Shell "explorer.exe " & SpecialPath, vbNormalFocus
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top