default filepath in XP  
Author Message
Synapse





PostPosted: Wed Sep 15 19:41:10 CDT 2004 Top

MS Word VBA >> default filepath in XP

In Word 2k, the following code successfully "set" the default filepath:
Options.DefaultFilePath(Path:=wdUserTemplatesPath)="C:\Documents and
Settings\username\Application Data\Microsoft\Templates"

Now, in Word XP, this code results in an error:
Run-time error 4101
Illegal function call

If I use the macro recorder, to "set" the same path, I am unsuccessful
(won't let me select this folder), but if I use the macro recorder to "set"
the path to "C:\" , I am successful, and then g0don't get the error on
running the sub. Is there some different kind of permissions structure for
XP files for my chosen filepath in XP, or else what's the deal, guys?

TIA

Word135  
 
 
Jean-Guy





PostPosted: Wed Sep 15 19:41:10 CDT 2004 Top

MS Word VBA >> default filepath in XP Bonjour,

Dans son message, < zSplash > écrivait :


|| In Word 2k, the following code successfully "set" the default filepath:
|| Options.DefaultFilePath(Path:=wdUserTemplatesPath)="C:\Documents and
|| Settings\username\Application Data\Microsoft\Templates"
||
|| Now, in Word XP, this code results in an error:
|| Run-time error 4101
|| Illegal function call
||
|| If I use the macro recorder, to "set" the same path, I am unsuccessful
|| (won't let me select this folder), but if I use the macro recorder to
"set"
|| the path to "C:\" , I am successful, and then g0don't get the error on
|| running the sub. Is there some different kind of permissions structure
for
|| XP files for my chosen filepath in XP, or else what's the deal, guys?
||

Works OK here (I pasted your code in a Word XP module).
Are you sure you did not forget to change "username" for the actual name?
Just checking... you never know! I have done much dumber mistakes!
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP

Word MVP site: http://www.word.mvps.org