Solved

VBA command gives wrong value

Posted on 1998-08-08
1
397 Views
Last Modified: 2008-02-01
I want to capture the default document path (as found in
Tools/Options/File Locations...) into a variable. Word 97
VBA help gives this code in an example:

     DocPath = Options.DefaultFilePath(wdDocumentsPath)

Even though this approach comes directly from Microsofts
documentation (???), it yields the wrong path into the
variable. Instead of the default document path, it makes
DocPath equal whatever path that was last used in the
File/Open window.

This is mysterious to me, for all of the other "wd . . ."
constants work correctly when used with Options.DefaultPath.
Any ideas?
0
Comment
Question by:JimKirby
1 Comment
 
LVL 1

Accepted Solution

by:
sparko earned 100 total points
ID: 1613056
you have to consult the registry for that to display it use

MsgBox System.ProfileString("Options", "Doc-Path")

The "System.ProfileString" command allows you to view or change any of the WORD registry settings and the doc path you want is one of them.  Options.DefaultFilePath(wdDocumentsPath) is the path that will be the default path for the file open/save box this changes when a user changes it.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
This article will show you how to use shortcut menus in the Access run-time environment.
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question