DefaultFilePath(wdDocumentsPath) returns wrong path

P

Paul H

The Word 2003 VB code below is from the new method of a word template(.dot)
file.

The last line should return the document path from the File Locations tab
of the Word Options dialogue box. Instead it incorrectly returns the
workgroups templates path (which is the path of the current word template).

If I change the code to return the startup path or tools path it correctly
returns the startup and tool paths respectively.

Can any one suggest why it does not work for the documents path or how to
access the documents path?

'************* Sample Code *********
Private Sub Document_New()

'Inititialse values on user data entry form
PupilForm.DocumentPathName.Value =
Application.Options.DefaultFilePath(wdDocumentsPath)

'***********End of Sample Code*******
 
B

Beth Melton

Is the Documents location My Documents? If that's the case Word
doesn't store this location in the Registry and the current folder
will be used instead. Once you modify the Documents location and use a
folder other than My Documents then the DOC-PATH value gets added to
the Registry and at this point your macro will run as expected.

Since wdDocumentsPath will give you mixed results use this instead:
Dialogs(wdDialogToolsOptionsFileLocations).Setting

Please post all follow-up questions to the newsgroup. Requests for
assistance by email can not be acknowledged.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP

TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top