Hi, I Have this code which is used when exporting to excel from Navision. This code is currently is looking for an existing document to update, how can I change this for creating a fresh new document.
recCPSetup.FINDFIRST;
strFilepath:='U:\CustomerParts.xlsx'; //Specify the location where the excel file is stored locally
IF ISCLEAR(xlApp) THEN
CREATE(xlApp, FALSE, TRUE);
xlApp.Visible(TRUE);
//1. Opening the excel file
xlBook:=xlApp.Workbooks.Open(strFilepath);//specify your file path with the filename.xls(x)
xlBook:=xlApp.ActiveWorkbook;
//2. Specify the excel sheet name
xlSheet := xlBook.Worksheets.Item('Sheet1');
Name DataType Subtype Length
xlApp / Automation / 'Microsoft Excel 16.0 Object Library'.Application
xlBook / Automation / 'Microsoft Excel 16.0 Object Library'.Workbook
xlSheet / Automation / 'Microsoft Excel 16.0 Object Library'.Worksheet
*This post is locked for comments
I have the same question (0)