Change directory

  • Thread starter Thread starter Shona
  • Start date Start date
S

Shona

Is there a way to really force a macro to change the directory

I have ChDir "c:\Data"

but if the file is opened from Explorer it defaults to the directory that
the user has set as their default in Excel? If the user removes their
default it's fine but they don't really want this.

Cheers
Shona
 
Perhaps the file from explorer exists in the D-Drive somewhere, and Chdir will change paths, not drives. Do this
ChDrive "C
ChDir "C:\Data

----- Shona wrote: ----

Is there a way to really force a macro to change the director

I have ChDir "c:\Data

but if the file is opened from Explorer it defaults to the directory tha
the user has set as their default in Excel? If the user removes thei
default it's fine but they don't really want this

Cheer
Shon
 
Unfortunately that didn't change it.

Any other ideas?

Thanks Shona

Bob Umlas said:
Perhaps the file from explorer exists in the D-Drive somewhere, and Chdir
will change paths, not drives. Do this:
 
You sure?

Option Explicit
Sub testme01()

ChDrive "C"
ChDir "C:\windows"
MsgBox CurDir

ChDrive "A"
ChDir "a:\xxx"
MsgBox CurDir

End Sub

Changed the drive and directory and showed it to me!
 
Thanks I think the reason it hasn't worked is because it is within quite a
complicated macro well complicated to me.

So have found a solution by using Dim strDir As String

Thanks for your help

Shona
news:[email protected]...
 
Back
Top