Solved

VBA command gives wrong value

Posted on 1998-08-08
1
393 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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Problem: You created a new custom form in Outlook for your contacts (added fields, deleted fields, changed the layout of fields, whatever) and made it the default form for contacts. The good news is that all new contacts will utilize the new form. T…
My experience with Windows 10 over a one year period and suggestions for smooth operation
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 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

8 Experts available now in Live!

Get 1:1 Help Now