Hi
I'm trying to save XLS file as XLSX file using below code.
XlApp DotNet Microsoft.Office.Interop.Excel.ApplicationClass.'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
XlWrkBk DotNet Microsoft.Office.Interop.Excel.Workbook.'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
XlWrkSht DotNet Microsoft.Office.Interop.Excel.Worksheet.'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
XlHelper DotNet Microsoft.Dynamics.Nav.Integration.Office.Excel.ExcelHelper.'Microsoft.Dynamics.Nav.Integration.Office, Version=10.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
ExcelXlSaveAsAccessMode DotNet Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
ExcelFileFormat DotNet Microsoft.Office.Interop.Excel.XlFileFormat.'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
XlsFilename := C:\123.xls;
XlsxFilename := C:\123.xlsx;
XlApp := XlApp.ApplicationClass;
XlHelper.CallOpen(XlApp,XlsFilename);
XlWrkBk := XlApp.ActiveWorkbook;
XlWrkBk.SaveAs(XlsxFilename,ExcelFileFormat.xlWorkbookDefault,'','', FALSE, FALSE,
ExcelXlSaveAsAccessMode.xlNoChange, FALSE, FALSE, FALSE, FALSE, FALSE);
XlWrkBk.Close(FALSE,'',TRUE);
but receiving the below error.
Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))
*This post is locked for comments
Hey, i checked in NAV 2017. its working.
only the thing is you have to re-declare the variables again.
Better, Copy XlHelper variable from Table 370.
Hi
Receiving this error, can you check in 2017(I think you are checking in 2016)
Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))
Hello Raj,
see the bellow screenshot, this solution works perfectly. you can also use your old_filename with .xlsx
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156