Announcement

Collapse
No announcement yet.

error 1004 excel vba workbooks.open

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • error 1004 excel vba workbooks.open



    Hi all.
    Before I decided to write this post, I had a look trying to google my stupid error, but I couldn't find anything that looks exactly like my issue.
    Code:
    Workbooks.Open Filename:="c:\files\clients.xlsx"
    Workbooks("clients.xlsx").Worksheets(1).Range("a1" & ":x500").Copy _                 
                                                                     Workbooks("cash").Worksheets(2).Range("A1")
    The thing is that on my computer at work (windows 7 enterprise with office 2007 professional) the code runs without any problem.
    And when I opened the same file on my laptop (same SO, same office) appear the following error: Run-time error '1004' Method 'Open' of object 'Workbooks' failed.
    Please! Help!

    Thank you in advance.
    Gabi

    P.S. By the way. Very nice job with this site, guys!

  • #2
    Re: error 1004 excel vba workbooks.open

    Strangely enough, if the file does not exist, Excel throws a 1004 File not found error rather than the 'real' file not found error which is Error 53.
    Are you absolutely sure the file you're referencing exists and is not corrupt?

    Comment


    • #3
      Re: error 1004 excel vba workbooks.open

      Originally posted by cytop View Post
      Strangely enough, if the file does not exist, Excel throws a 1004 File not found error rather than the 'real' file not found error which is Error 53.
      Are you absolutely sure the file you're referencing exists and is not corrupt?
      Hello.

      Thank you for replying so fast.

      I'm absolutely sure that the file exists and is not corrupted.
      Gabi

      Comment


      • #4
        Re: error 1004 excel vba workbooks.open

        hmmm...
        strangely enogh, you were right. that file was corrupt.
        I've spent a whole day trying to figure it out.

        Thank you very much.

        Best regards,
        Gabi

        Comment


        • #5


          Re: error 1004 excel vba workbooks.open

          I have experienced this same issue and the resolution was to do a "File/Save As" and re-save the file on your drive. This enables excel to "see" the drive mapping where it is saved and will permit the code to run.

          Comment

          Working...
          X