ChDir "F:\dump" - not working

  • Thread starter Thread starter Madiya
  • Start date Start date
M

Madiya

I am using xl2007.
Im my macro, I am trying to change link in all cells by pointing them
to the new file.
I have tried only file name with chdir and full file name with path
but none works.
ChDir "F:\dump" is not changing the dir at all. Excel still keep
pointing to my documents.

Its simple but I cant get it straight.
Pl help.

Regards,
Madiya
 
Hi Madiya

Try this:

ChDrive "F:\"
ChDir "F:\Dump"
FileToOpen = Application.GetOpenFilename _
(Title:="Select a File", _
FileFilter:="Excel Files *.xls (*.xls),")

If FileToOpen = False Then
MsgBox "No File has been Selected.", vbExclamation, "Doh!!!"
Exit Sub
Else
Workbooks.Open Filename:=FileToOpen
End If

HTH
Mick
 
HiMadiya

Try this:

    ChDrive "F:\"
    ChDir "F:\Dump"
    FileToOpen = Application.GetOpenFilename _
    (Title:="Select a File", _
    FileFilter:="Excel Files *.xls (*.xls),")

    If FileToOpen = False Then
    MsgBox "No File has been Selected.", vbExclamation, "Doh!!!"
    Exit Sub
    Else
    Workbooks.Open Filename:=FileToOpen
    End If

HTH
Mick

It worked.
Thanks a ton.

Regards,
Madiya
 
Back
Top