Excel file downloaded without VBA module

89 Views Asked by At

I have developed a code which allows me to download an Excel file based on a prepared template that contains vba code and macro.

The code below allow me to create calendar workbook from template file.

        String nomFichierExcel = "D:\\Calendrier"+annee+"-"+versionFac+"-"+versionPrel+".xls"; 
        String filePath = "D:\\test3107\\test-calender-war\\CALWAS\\templateee.xls";                    
        WorkbookSettings ws = new WorkbookSettings() ;
        ws.setEncoding("Cp1252");
        Workbook workbook = Workbook.getWorkbook(new File(filePath),ws); 
        WritableWorkbook copy = Workbook.createWorkbook(new File(nomFichierExcel), workbook ); 

The problem is after downloading the Excel file I cannot find the vba code and module when I press ALT + F11, also when I open the file I get this as error message, but I can see data after clicking OK button.

File error: data may have been lost

0

There are 0 best solutions below