View Full Version : Help needed guys please. Object failed
hpoolsteve
07-18-2017, 03:29 AM
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
mdmackillop
07-18-2017, 03:41 AM
Check the file extension. It may be xlsx, xlsm or other
hpoolsteve
07-18-2017, 03:59 AM
The file extension that its trying to open is .xls
Aflatoon
07-18-2017, 04:07 AM
What is the exact error message?
hpoolsteve
07-18-2017, 04:10 AM
Run Time error 1004
Method 'open' of object 'workbooks' failed.
Then the debug line is as above that i pasted
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
hpoolsteve
07-18-2017, 04:41 AM
It does say exist, when i create a dummy macro with that code
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?
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.