You were right on; I registered the Object & it compiled OK.
Thank you for your help.
HJ
BTW 2 oddities, I thought:-
1. .LookIn = "C:\My Documents" doesn't work.
I had to use "C:\Documents and Settings\Administrator\My Documents"
2. I thought that you had to use \\ to get a \ in strings but
"C:\Documents and Settings" & "C:\\Documents and Settings" both work
the same.
>>msoFileTypeAllFiles
>
[quoted text clipped - 6 lines]
>ALternatively, you could replace msoFileTypeAllFiles with its literal
>value, 1.
John Nurick - 30 Apr 2005 17:02 GMT
>BTW 2 oddities, I thought:-
>
>1. .LookIn = "C:\My Documents" doesn't work.
> I had to use "C:\Documents and Settings\Administrator\My Documents"
This is normal behaviour for Windows. "C:\My Documents" specifies *a*
folder called "My Documents" in the root of the the C: drive, not the
user's actual "My Documents" folder.
In standard English-language installations of Windows you can normally
get the user's My Documents with
strMyDocsFolder = Environ("USERPROFILE") & "\My Documents"
but I don't think you can be 100% certain that the My Documents folder
is actually called My Documents, or indeed that %USERPROFILE% has not
been tampered with, so it's probably safer to use
set WshShell = CreateObject("WScript.Shell")
strMyDocsFolder WshShell.SpecialFolders("MyDocuments")
or the Windows API function SHGetSpecialFolderLocation().
>2. I thought that you had to use \\ to get a \ in strings but
>"C:\Documents and Settings" & "C:\\Documents and Settings" both work
>the same.
In C-like languages you have to escape a backslash with a backslash, but
not in VBA. (IIRC backslashes in Word fields also need to be doubled.)
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.