View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
ion ion is offline
external usenet poster
 
Posts: 12
Default IWshRuntimeLibrary.WshShell.SpecialFolders requires a variant argument

Nick,
I don't think this is handled by .NET. I'm in the vba Engine in
Excel! I can shut down the framework, and it works great.
If a path fails to resolve, I check if its first token is a special
folder name. That was my goal, and I was surprised that passing the
token as a string didn't give me the correct answer. It must be passed
as a variant.
Ion

NickHK wrote:
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