G
goaljohnbill
In excel 2003 windows xp I have been using the following code for a
long time successfully:
sub ForceDirectoryOpenSave
Dim strStartingDirectory As String
strStartingDirectory = CurDir
ChDrive "T"
ChDir "T:\xx\xy\xu\xa"
' code for whatever application.get___ i need
ChDrive strStartingDirectory
ChDir strStartingDirectory
end sub
Recently I have started having errors on the line;
ChDrive strStartingDirectory
It seems to happen randomly ie not every time the users have that
code, or even every time the machine is restarted ect and if you rerun
the sub (or skip JUST that line in subs without full error handling)
it works. After reading through groups I assume that the system admins
(i work at a large public university) have started controlling some
things with UNC paths and when excel last used a UNC path it errors.
All of our data/workspace is on the T drive so I dont have to be able
to "point" to UNC paths for the dialogs. I just am tired of subs being
dropped out of randomly and having to figure out how to get the user
back to where they need to be to continue working without negative
effects.
What are the "consequences" (if any) of not changeing the Drive back
to match the starting directory but changing the directory back? Or
using OnError Resume Next to "shut off" my regular error handling for
these instances to stop this from dropping users out of subs (then
after that line using OnError Goto ErrorHandler to "turn on" normal
error handling again) so that when excel is pointing to a mapped drive
it still changes it back?
thanks
john
long time successfully:
sub ForceDirectoryOpenSave
Dim strStartingDirectory As String
strStartingDirectory = CurDir
ChDrive "T"
ChDir "T:\xx\xy\xu\xa"
' code for whatever application.get___ i need
ChDrive strStartingDirectory
ChDir strStartingDirectory
end sub
Recently I have started having errors on the line;
ChDrive strStartingDirectory
It seems to happen randomly ie not every time the users have that
code, or even every time the machine is restarted ect and if you rerun
the sub (or skip JUST that line in subs without full error handling)
it works. After reading through groups I assume that the system admins
(i work at a large public university) have started controlling some
things with UNC paths and when excel last used a UNC path it errors.
All of our data/workspace is on the T drive so I dont have to be able
to "point" to UNC paths for the dialogs. I just am tired of subs being
dropped out of randomly and having to figure out how to get the user
back to where they need to be to continue working without negative
effects.
What are the "consequences" (if any) of not changeing the Drive back
to match the starting directory but changing the directory back? Or
using OnError Resume Next to "shut off" my regular error handling for
these instances to stop this from dropping users out of subs (then
after that line using OnError Goto ErrorHandler to "turn on" normal
error handling again) so that when excel is pointing to a mapped drive
it still changes it back?
thanks
john