View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.misc
GS[_6_] GS[_6_] is offline
external usenet poster
 
Posts: 1,182
Default Help needed in hanging the default file location for Excel and Word

This is a better approach...

Sub ResetRecentPaths()
Const sOldPath$ = "C:\office documents" '//edit to suit
Const sNewPath$ = "C:\Users\Kirk\Documents" '//edit to suit

Dim n&, lCount&, saFiles$()

'Store current paths in array
lCount = Application.RecentFiles.Count
ReDim saFiles(1 To lCount)
With Application.RecentFiles
For n = LBound(saFiles) To UBound(saFiles)
saFiles(n) = Replace(.Item(n).Path, sOldPath, sNewPath)
Next 'n

'Clear existing RecentFiles list
For n = UBound(saFiles) To LBound(saFiles) Step -1
.Item(n).Delete
Next 'n

'Add the modified paths to RecentFiles
.Maximum = lCount
For n = UBound(saFiles) To LBound(saFiles) Step -1
.Add saFiles(n)
Next 'n
End With 'Application.RecentFiles
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion