Solved

VBA command gives wrong value

Posted on 1998-08-08
1
396 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

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 …
No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
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: …

831 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