Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
yadav_anil782
Creator II
Creator II

export to excel macro

HI Jagan ,

as per discuss plz look into this marco ,its not exporting  table value in excel

FUNCTION ExcelExport("TB01") set obj = ActiveDocument.GetSheetObject( "TB01") w = obj.GetColumnCount

if obj.GetRowCount>1001 then h=1000 else h=obj.GetRowCount end if Set objExcel = CreateObject("Excel.Application") objExcel.Workbooks.Add objExcel.Worksheets(1).select()

objExcel.Visible = True set CellMatrix = obj.GetCells2(0,0,w,h) column = 1

  for cc=0 to w-1 objExcel.Cells(1,column).Value = CellMatrix(0)(cc).Text objExcel.Cells(1,column).EntireRow.Font.Bold = True

   column = column +1 next c = 1 r =2 for RowIter=1 to h-1 for ColIter=0

   to w-1 objExcel.Cells(r,c).Value = CellMatrix(RowIter)(ColIter).Text c = c +1 next r = r+1 c = 1

   next END FUNCTION  SUB CallExample ExcelExport( "TB01" ) END SUB

Labels (1)
3 Replies
settu_periasamy
Master III
Master III

Hi,

Try the same code with Aligned...and give the Macro Name in the Actions Tab.. Here ExcelExport

FUNCTION ExcelExport()

set obj = ActiveDocument.GetSheetObject( "TB01")

w = obj.GetColumnCount

if obj.GetRowCount>1001 then

  h=1000

else h=obj.GetRowCount

end if

Set objExcel = CreateObject("Excel.Application")

  objExcel.Workbooks.Add

  objExcel.Worksheets(1).select()

  objExcel.Visible = True

  set CellMatrix = obj.GetCells2(0,0,w,h)

  column = 1

  for cc=0 to w-1

  objExcel.Cells(1,column).Value = CellMatrix(0)(cc).Text

  objExcel.Cells(1,column).EntireRow.Font.Bold = True

   column = column +1

   next

   c = 1

   r =2

   for RowIter=1 to h-1

   for ColIter=0 to w-1

    objExcel.Cells(r,c).Value = CellMatrix(RowIter)(ColIter).Text

    c = c +1

    next

    r = r+1

    c = 1

   next

END FUNCTION 

Don't forget to do the Below Settings in Macro Module

Requested Module Security -> System Access
Current Local Security -> Allow System Access

Find the attached for your reference

yadav_anil782
Creator II
Creator II
Author

Dear Settu,

this part i already i done but main issue is in send   this table throw email with schedule timing.plz hlep if you can .

qlikviewwizard
Master II
Master II