0 Replies Latest reply: Mar 5, 2018 7:20 AM by amber rebma RSS

    export to excel append file

    amber rebma

      Hi


      i am trying export table into excel in qlikview .. i want one time file save and when later any changes occurred in table or any new record is add then want just update that excel file and also want headers .. not want to create whole new sheet again .. this is what i try


      this code is doing every time new excel file


          sub ExcelExport 

          Set objExcel = CreateObject("Excel.Application") 

          objExcel.Visible = True 

          objExcel.DisplayAlerts = True 

          Set xlDoc = objExcel.Workbooks.Add 

          set obj = ActiveDocument.GetSheetObject("TB01") 

          obj.CopyTextToClipboard 

          objExcel.Range("A1").PasteSpecial 

          xlDoc.SaveAs "C:\Users\HP\Desktop\work\Test.xlsx" 

          

         

          Set xlSheet = xlDoc.Worksheets("Sheet1")   ' Replace Sheet1 with your sheet name 

          xlSheet.Activate 

          LastRow = xlSheet.Cells(xlSheet.Rows.Count, 1).End(xlUp).Row 

          msgbox LastRow 

          xlSheet.Cells(LastRow + 1, 1).Select 

          xlSheet.Paste

          objExcel.Visible = True 

          end sub