Splitting Excel 2010 files into multiple Excel 2003 files

  • Hi all,


    I have created a macro which can split files data into various workbook based on count of rows each split files having 60K records and it's working fine as far as files are concerned however these files need to be uploaded into an application which is based on 2003 POI i.e. you can't upload 2010 files.


    Code given below


    When I try uploading the resultant files we are getting an exception given below.


    org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals with OLE2 Office Documents. You need to call a different part of POI to process this data (eg XSSF instead of HSSF)


    Hence I would some help in Splitting Excel 2010 files into multiple Excel 2003 files...Is it even possible.

  • Re: Splitting Excel 2010 files into multiple Excel 2003 files


    Try this


    Code
    wbNew.Close SaveChanges:=True, Filename:=ThisWorkbook.path & "\App_Invetory" & "-" & lCopy & ".xls" ,fileformat:=56


    fileformat makes the workbook saved into the format you described.

  • Re: Splitting Excel 2010 files into multiple Excel 2003 files


    Thanks. Tried, its giving Compile Error: Named Argument not found for FileFormat:=56

  • Re: Splitting Excel 2010 files into multiple Excel 2003 files


    my bad didn't saw you were using .close use saveas instead


    Code
    wbNew.saveas Filename:=ThisWorkbook.path & "\App_Invetory" & "-" & lCopy & ".xls" ,fileformat:=56
  • Re: Splitting Excel 2010 files into multiple Excel 2003 files


    Tried this as well

    Code
    weNew.SaveAs Filename:=StrFileName, FileFormat:=56
                wbNew.Close SaveChanges:=True


    Now it's giving an error Run Time Error '424' Object required. Please help.

  • Re: Splitting Excel 2010 files into multiple Excel 2003 files


    Quote


    weNew.SaveAs Filename:=StrFileName, FileFormat:=56


    should it be wbnew?

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!