Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pathname from recent documents 2

Status
Not open for further replies.

robertsquestion

Technical User
Jul 16, 2003
81
GB
Hi,

We're using Word 2000 on Windows 2000 and got the following question: If you go to "File" in the Word-menubar, you get a list of recent Word-documents. But you don't see the complete pathname of the file. Is there a way to retrieve the full pathname?

Thanks for your help!
Regards,
Robert
The Netherlands
 
I know Word 2002 does that automatically but I can't find anything on how to change that in Word 2000.

If anyone calls and says "I know a little something about computers" just tell them to reformat it.
 
methinks that data is stored somwhere in registry - you should be able to grab it with vba but that might be more trouble then it's worth
 
Hi Naug,

Could you please explain how you can grab it with VBA?
Thanks for your help!

Regards,
Robert
 
Try to select "open", click yourself to a folder empty of worddocuments, press cancel. clicking "file" menu now, the paths should appear.

In Word 2000, the complete pathname is removed if your active path is the same as the files path. Meaning that if your active path (the one that shows up when you click "save as" or "open", whichever latest used) is the same as the path of the recently used file, then the path isn't showed.


// Patrik
 
Code:
Sub rFiles()
Dim rFile As RecentFile
For Each rFile In Application.RecentFiles
    MsgBox rFile.Path & Application.PathSeparator & rFile.Name
Next
End Sub

displays all recent files in separate message boxes. could of course, build array of these to use for other code.

Code:
Sub rFilesArray()
Dim myRecentFiles() As String
Dim i As Integer
Dim rFile As RecentFile
Dim msg As String

If Application.RecentFiles.Count >= 1 Then
    For Each rFile In Application.RecentFiles
        ReDim Preserve myRecentFiles(i)
        myRecentFiles(i) = Application.RecentFiles(i + 1).Path _
            & Application.PathSeparator & _
            Application.RecentFiles(i + 1).Name
' // build string of all recent files on
' // separate line
        msg = msg & myRecentFiles(i) & vbCrLf
        i = i + 1
    Next
Else
    Exit Sub
End If
' // display messagebox with ALL recent files
MsgBox msg
' // display messagebox with just file #3
' // array is 0 based
MsgBox myRecentFiles(2)
End Sub

example displays full path and name of third file in list - array is 0 based
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top