Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot open files generated by JDE

Status
Not open for further replies.
Aug 29, 2009
3
CA
Hi,

I'm trying to use VBA code to open a file (say "file1') generated by JDE. The code is simple:
"Workbooks.Open file1"
When I excute it, there is a error msg:" Method 'open' of object 'Workbooks' failed".

If I open it manually, it shows "Excel found unreadable content in file1. Do you want to recover the contents of this workbook?" Then I have to click "Yes" to open it.

Does anyone know how to overcome it?

Thanks,
Eugene
 
Is this a one-off, or a routine occurrence? If all your files exhibit this problem, I would look in the Java for the problem. If it's just one (or just the occasional) file, what is the error number? Is it unique? If so, you should be able to trap errors and check for it.

Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

I'm working (slowly) on my own website
 
Hi Tony,

Thanks for reply. It's a routin task - I have to open 160 files. The error msg shows:"Run-time error '1004'".

I want to know the reason and if there is a possible solution with VBA.

Thank you again.

Eugene
 
If I were you I would be looking to find out why you were creating faulty files, but ..

1004 is a fairly generic error, but maybe if you trapped it and then tried opening with CorruptLoad:=xlRepairFile (or xlExtractData) it might work

Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

I'm working (slowly) on my own website
 
Hi Tony,

These files were created by another guy, but...your solution works!

Thank you!

Eugene
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top