ChDir "F:\dump" - not working

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
 
V

Vacuum Sealed

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
 
M

Madiya

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top