File Locations in Options Menu (VBA question)

S

Sunouchi@

Hello,
While writing VBA code, I encounter a problem.
I want to save files in a the Documents map, as is set in Word by:
Tools > Options > File Locations > Documents. e.g.: D:\DocumentMap

I can read that file location with: str_StartPath =
Options.DefaultFilePath(wdDocumentsPath)

That works fine, untill I save (manually) a Word document in another
location, e.g. C:\OtherMap then the next time I run the code,
str_StartPath gives that new location (C:\OtherMap), as the default
save map

However, when I check the location manually (in Word) Tools > Options
File Locations > Documents: the original path (D:\DocumentMap) is
still there and hasn't changed.

Is there a way to read the right location (D:\DocumentMap) which is
seen in Tools > Options > File Locations > Documents, even if the
current document path has changed through a manual action? I mean: how
can I read the correct path (D:\DocumentMap) under any circumstances,
regardless of any (saving) action in Word manually, through VBA code?

Thanks in advance.
Sunouchi
 
J

Jonathan West

Hello,
While writing VBA code, I encounter a problem.
I want to save files in a the Documents map, as is set in Word by:
Tools > Options > File Locations > Documents. e.g.: D:\DocumentMap

I can read that file location with: str_StartPath =
Options.DefaultFilePath(wdDocumentsPath)

That works fine, untill I save (manually) a Word document in another
location, e.g. C:\OtherMap then the next time I run the code,
str_StartPath gives that new location (C:\OtherMap), as the default
save map

However, when I check the location manually (in Word) Tools > Options
still there and hasn't changed.

Is there a way to read the right location (D:\DocumentMap) which is
seen in Tools > Options > File Locations > Documents, even if the
current document path has changed through a manual action? I mean: how
can I read the correct path (D:\DocumentMap) under any circumstances,
regardless of any (saving) action in Word manually, through VBA code?


How to retrieve Word's default Documents path or Pictures path setting
http://www.word.mvps.org/FAQs/MacrosVBA/GetDocPath.htm
 
S

Sunouchi@

Wow, Jonathan! Thanks a lot.

Hello Jonathan,
the '.setting' doesn't show up after the
(wdDialogToolsOptionsFileLocations) and is not a part of the list of
the possible (what is the name of these things?) choises, as is, e.g.
Creator or Show. How comes?
Thanks in advance.
Sunouchi
 
J

Jonathan West

On Fri, 20 Jul 2007 20:58:45 +0200, Sunouchi@ wrote:
Hello Jonathan,
the '.setting' doesn't show up after the
(wdDialogToolsOptionsFileLocations) and is not a part of the list of
the possible (what is the name of these things?) choises, as is, e.g.
Creator or Show. How comes?


Because each dialog is different, and the Intellisense isn't bright enough
to cope. There is a help topic "Built-in dialog box argument lists" in the
Word VBA Help that lists the available arguments. This article may also help


Getting help with calling Word's built-in dialogs using VBA (and why doing
so can be much more useful than you'd think)
http://www.word.mvps.org/FAQs/MacrosVBA/WordDlgHelp.htm
 

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