Excel2003 VBA: 1004 error relates to XML import

Joined
Nov 20, 2009
Messages
1
Reaction score
0
Hi,

I built an macro which takes different XML input files and imports each one into a different worksheet in a workbook. It then saves the workbook. This works a treat 98% of the time with hundreds of users, but sometimes fails when saving the workbook with "Error 1004: Microsoft Office Excel cannot access the file 'C:\SymmPiT'.

I found it relates to when one of the XML files is too large for Excel to import in section "ImportDisks:". Trying to import the SYMDISK.XML file manually into a blank workbook (using "Data - Import - XML") brings Excel error "XML Import Error: Some Data failed to import".

I am trying to have Excel VBA ignore this XML import error. This works in the macro at that stage but then fails when saving the workbook further down in the code (marked in red).

How can I avoid Excel "barfing" when saving the file, even if there is an import error? Or can the XML file be checked somehow before importing so I can avoid trying the import?

Code exceprts are attached in Sub ImportData.doc

Many thanks for responses! :-)
 

Attachments

Back
Top