Solved

VBA command gives wrong value

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Office 2012 Compatibility 3 52
Access 2013 won't install with Office 2016 (Home and Business) 8 28
Mac-based software for Excel 8 38
Need a poor man's PowerPoint 5 73
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
Outlook Free & Paid Tools
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

910 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now