View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default IWshRuntimeLibrary.WshShell.SpecialFolders requires a variant argument

Any reason you are using a COM wrapper to .Net framework functions ?

Otherwise, use the normal Windows API :
http://vbnet.mvps.org/code/browse/csidl.htm

Or depending what you need:
Environ("USERPROFILE")
Environ("HOMEPATH")
Environ("HOMEDRIVE")

NickHK

"ion" wrote in message
oups.com...
This was hard to debug.
Dim bulb as new IWshRuntimeLibrary.WshShell
dim str as string, var as variant
str = "MyDocuments"
var = str
Debug.print bulb.SpecialFolders(str) ' prints the all users desktop
Debug.print bulb.SpecialFolders(var) ' prints the My Documents folder