help with a Word macro

C

c02homer

I am writing a macro that accesses templates on the local drive. The
path is C:\Documents and Settings\USERNAME\Application
Data\Microsoft\Templates.

Can anyone tell me how to access this location that is non-specific to
a user? I tried %username%, but my macro doesn't run properly. If I
put my own userid back in the path, it works, but I need to deploy this
macro firmwide.

Any help with this will be GREATLY appreciated!!!

Thank you!!
 
M

Michael Bednarek

I am writing a macro that accesses templates on the local drive. The
path is C:\Documents and Settings\USERNAME\Application
Data\Microsoft\Templates.

Can anyone tell me how to access this location that is non-specific to
a user? I tried %username%, but my macro doesn't run properly. If I
put my own userid back in the path, it works, but I need to deploy this
macro firmwide.

Try:
strTemplatePath = "C:\Documents and Settings\" & Environ("USERNAME") & "\Application Data\Microsoft\Templates"

or even simpler and more robust:
strTemplatePath = Options.DefaultFilePath(wdUserTemplatesPath)
 

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