How get program folder names ?

M

MoiMeme

Hi,

how can I get the program's folder names for :
- startup file
- templates
etc

from vba in order to avoid hardcoding them ( and hence loose validity of
code if I ever change folder localization) ?

TIA very much
 
G

Greg

This should do:

Sub Test()
Dim TmpPath$, StartUpPath$
TmpPath = Options.DefaultFilePath(Path:=wdUserTemplatesPath)
StartUpPath = Options.DefaultFilePath(Path:=wdStartupPath)
End Sub
 
M

MoiMeme

I get an error message "Compilation error" Function or variable expected !
Debug highlights the Options word.
using Word XP/2k2
Any idea why ?
 
G

Greg

MoiMeme,

I am using Word2000 and can't duplicate your error. It could be the
way the reader wrapped the text. The code shoule be 5 lines total.

If that doesn't sort it out, then record a macro of of changing the
startup and user templates and you should be able to see from that
recorded macro any differences there may be in the variable names
between Word2000 and your version.
 
M

MoiMeme

Notice that in the help file the example given by MS is also Option.... and
not Application.Option
Found that by trial and error as often !
Thanks again, coz you gave the hint I needed !
Now works fine !
 

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