Consulting

Results 1 to 8 of 8

Thread: Help needed guys please. Object failed

  1. #1

    Help needed guys please. Object failed

    Just a quick one for you guys. Im not very clued up with VB.

    I use a report that worked fine for ages. Then moved to a newer version of excel and now i get this error:

    Workbooks.Open Filename:= _
    "M:\SHARED\despatch\Despatch Reports\Tubes Report\Tubes Report.xls", ReadOnly:=True

    The drive mapping is correct. The file is there.

    Just not sure what its asking me to do.

    The guru who used to deal with has retired

    Thanks

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Check the file extension. It may be xlsx, xlsm or other
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    The file extension that its trying to open is .xls

  4. #4
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    What is the exact error message?
    Be as you wish to seem

  5. #5
    Run Time error 1004
    Method 'open' of object 'workbooks' failed.

    Then the debug line is as above that i pasted

  6. #6
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    Quote Originally Posted by hpoolsteve View Post
    Run Time error 1004
    Method 'open' of object 'workbooks' failed.

    Then the debug line is as above that i pasted
    In a new/junk workbook, try:

    Sub example()
      
      MsgBox IIf(Len(Dir("M:\SHARED\despatch\Despatch Reports\Tubes Report\Tubes Report.xls", vbNormal)) > 0, "Exists", "Doesn't")
      
    End Sub
    If it says it exists, I would suggest stepping thru your code and ensuring which line is causing the error.

    Mark

  7. #7
    It does say exist, when i create a dummy macro with that code

  8. #8
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    Okay, then create a junk copy of your workbook, place a break-point (F9) some lines ahead of the line of code you posted, then step-thru the code with the F8 key. What line hiccups?

Posting Permissions

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