Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Jan 2005
    Location
    Gwent, Wales
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Open Workbook (Excel 2002)

    Hi,

    I'm having problems with the following:

    Workbooks.Open Dir(ActiveWorkbook.Path & "Book3.xls"), UpdateLinks:=0

    What I'm trying to do is open Book3 from Book2 which is already open. Book3 is in the same directory as Book2. This code works fine until you reboot your PC, you then get a message telling you that Book3 can not be found even though you can see it in the relevant directory. How can I fix this?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Open Workbook (Excel 2002)

    I don't think you should use the Dir function here. Dir returns a file name without the path, so the result of Dir(ActiveWorkbook.Path & "Book3.xls") is "Book3.xls". If Book3.xls is not in the currently active folder, Open will fail. Try

    Workbooks.Open ActiveWorkbook.Path & "Book3.xls", UpdateLinks:=0

  3. #3
    Lounger
    Join Date
    Jan 2005
    Location
    Gwent, Wales
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open Workbook (Excel 2002)

    Hans,

    Thanks again, that works fine.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •