ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Help needed in hanging the default file location for Excel and Word (https://www.excelbanter.com/excel-discussion-misc-queries/454211-help-needed-hanging-default-file-location-excel-word.html)

Kirk Bubul[_2_]

Help needed in hanging the default file location for Excel and Word
 
I first started using Office 4.3 (?) when it had Word 2.0 in
1993. I have always created my own folder in c:\office documents
to store my work products. I have never used the Documents area
that Windows created.

I am now using Office 365 MSO (16.0.11126.20192) 32-bit in a
Windows 10 Pro 1809 setup. I finally decided to utilize the
Documents area. So I moved all my Word and Excel files to the
Documents folder: C:\Users\Kirk\Documents. Everything search
confirms that all the .docx and .xlsx files are there.

I now have a problem. When I go into Word or Excel and try to
bring up a file, it rejects my request, saying that it can't find
my old default location. When I use the Help function in Excel,
it misleads by telling me to go: File, Options, General, Info
Path Options, more options. However, there is NO Info Path
Options choice available in either Excel or Word. When I go:
File, Options, Save I am presented with a chance to set the
Default Local file location. I change that and click Okay, but
the next time I try to get that file, it says that it can't find
it, referring to the old file location. The error message doesn't
tell me how to change the default location of moved files.

When I try to open a file that I've changed the default location
on, it rejects me. I can Browse to that file at
C:\Users\Kirk\Documents and open it, and I can look at the File,
Options, Save, default local file location, and it says that is
C:\Users\Kirk\Documents. But that new location doesn't "take."

What am I doing wrong? Is there a way to change the file
location so that I can open my files without having to browse to
them each time?

Thanks in advance for any help.

GS[_6_]

Help needed in hanging the default file location for Excel and Word
 
I first started using Office 4.3 (?) when it had Word 2.0 in
1993. I have always created my own folder in c:\office documents
to store my work products. I have never used the Documents area
that Windows created.

I am now using Office 365 MSO (16.0.11126.20192) 32-bit in a
Windows 10 Pro 1809 setup. I finally decided to utilize the
Documents area. So I moved all my Word and Excel files to the
Documents folder: C:\Users\Kirk\Documents. Everything search
confirms that all the .docx and .xlsx files are there.

I now have a problem. When I go into Word or Excel and try to
bring up a file, it rejects my request, saying that it can't find
my old default location. When I use the Help function in Excel,
it misleads by telling me to go: File, Options, General, Info
Path Options, more options. However, there is NO Info Path
Options choice available in either Excel or Word. When I go:
File, Options, Save I am presented with a chance to set the
Default Local file location. I change that and click Okay, but
the next time I try to get that file, it says that it can't find
it, referring to the old file location. The error message doesn't
tell me how to change the default location of moved files.

When I try to open a file that I've changed the default location
on, it rejects me. I can Browse to that file at
C:\Users\Kirk\Documents and open it, and I can look at the File,
Options, Save, default local file location, and it says that is
C:\Users\Kirk\Documents. But that new location doesn't "take."

What am I doing wrong? Is there a way to change the file
location so that I can open my files without having to browse to
them each time?

Thanks in advance for any help.


Excel stores the full path to the files on its Recent list; - since you've
moved those file to a different path, Excel can't find them in the 'stored'
path.

You need to Browse the 1st time you open any of those files so Excel stores the
new path for each one!

--
Garry

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

Kirk Bubul[_2_]

Help needed in hanging the default file location for Excel and Word
 
On Tue, 15 Jan 2019 14:25:56 -0500, GS wrote:



Excel stores the full path to the files on its Recent list; - since you've
moved those file to a different path, Excel can't find them in the 'stored'
path.

You need to Browse the 1st time you open any of those files so Excel stores the
new path for each one!


Thanks, Garry, I was afraid of that.

dpb

Help needed in hanging the default file location for Excel andWord
 
On 1/15/2019 3:14 PM, Kirk Bubul wrote:
On Tue, 15 Jan 2019 14:25:56 -0500, GS wrote:



Excel stores the full path to the files on its Recent list; - since you've
moved those file to a different path, Excel can't find them in the 'stored'
path.

You need to Browse the 1st time you open any of those files so Excel stores the
new path for each one!


Thanks, Garry, I was afraid of that.


I really "know nuthink!" of any of the Office products other than the
bare basics, but can't you clear the Recent Files list and then won't it
use default locations when open the File menu?

--




GS[_6_]

Help needed in hanging the default file location for Excel and Word
 
On 1/15/2019 3:14 PM, Kirk Bubul wrote:
On Tue, 15 Jan 2019 14:25:56 -0500, GS wrote:



Excel stores the full path to the files on its Recent list; - since you've
moved those file to a different path, Excel can't find them in the
'stored'
path.

You need to Browse the 1st time you open any of those files so Excel
stores the
new path for each one!


Thanks, Garry, I was afraid of that.


I really "know nuthink!" of any of the Office products other than the bare
basics, but can't you clear the Recent Files list and then won't it use
default locations when open the File menu?


That would be the same as browsing to the new location of the files via the
'Open' menuitem. Kirk suggests he already did change the default path, but is
clicking a file (shortcut link) to open on the Recent list.

Clearing that list is probably a good idea because it will remove the natural
tendancy to select previously worked on files while rebuilding the list with
the new path where those files were moved. However, I don't see a feature in
the UI to clear the Recent list so will have to be done manually!

The path to the list is:
C:\Users\<username\AppData\Roaming\Microsoft\Offi ce\Recent

Optionally, the files in this folder could be modified to change their 'Target'
via the Properties dialog, Shortcut tab -OR- via code. The latter would require
looping all the files in the folder and setting/modifying their target property
via VB[A]'s Replace() function.

IE:
Const sOldPath$ = "C:\office documents"
Const sNewPath$ = "C:\Users\Kirk\Documents"

Dim sTarget$
'code to loop the folder 1 file at a time

'code to get current Target property
sTarget = Replace(sTarget, sOldPath, sNewPath)
'code to set new Target Property

'code to get the next file

Note that no error is raised if sOldPath isn't found, so only those with the
old path will be updated.

Unfortunately, Application.RecentFiles.Item(#).Path is READ ONLY and so some
other approach is required to edit paths. Perhaps the new DsoFile.dll is one
way to go.

You can use VBA, however, to read the existing path, modify it as above, then
..Add a new Item so each file gets replaced with its new path instead of having
to browse for every one manually...

Sub ResetRecentPaths()
Const sOldPath$ = "C:\office documents"
Const sNewPath$ = "C:\Users\Kirk\Documents"

Dim sTarget$, v
For Each v In Application.RecentFiles
sTarget = Replace(v.Path, sOldPath, sNewPath)
Application.RecentFiles.Add sTarget
Next 'v
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

GS[_6_]

Help needed in hanging the default file location for Excel and Word
 

Sub ResetRecentPaths()
Const sOldPath$ = "C:\office documents"
Const sNewPath$ = "C:\Users\Kirk\Documents"

Dim sTarget$, v
For Each v In Application.RecentFiles
sTarget = Replace(v.Path, sOldPath, sNewPath)
Application.RecentFiles.Add sTarget
Next 'v
End Sub


Note that this approach will replace the RecentFiles list In Excel, and bumping
the list so Item(1) becomes Item(2) after adding. That said, it's not a good
approach!

--
Garry

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

GS[_6_]

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

GS[_6_]

Help needed in hanging the default file location for Excel and Word
 
Change 1 line as follows...

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.Maximum

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


All times are GMT +1. The time now is 10:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com