Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Aug 2001
    Location
    Cape Town, South Africa, South Africa
    Posts
    399
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Opening a file (Excel 2002)

    I've written code (listed below) in Excel 2000 but it gives me a error: Run-time error '1004': method 'Open' of object 'Workbooks' failed. I've I try and open the file manually it works fine. Did anything change?

    ChDir "z:"
    Workbooks.Open FileName:="Z:FinanceYesterday.xls"

    Thanks for your help

  2. #2
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Brussels, Brussel, Belgium
    Posts
    159
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Opening a file (Excel 2002)

    hi Mario,

    are you sure the filepath is correct?
    if the z drive is a network share, it might have been moved to another letter. if that's the case, it is advisable to use the unc instead of the driveletter, for instance
    workbooks.open "my servermysharefinanceyesterday"

    also you don't need the chdir statement when you fully qualify the path to the file, as you are doing.
    the chdir statement will not switch to the z-drive, you need the statement chdrive instead (in combination with chdir if needed)

Posting Permissions

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