?
Solved

VBA command gives wrong value

Posted on 1998-08-08
1
Medium Priority
?
399 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
sparko earned 200 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

Industry Leaders: 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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

752 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