Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Live chat with experts, bring your API Integration questions. June 15th, 10 AM ET. REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
jakob_hansen
Partner
Partner

Export macro fails

When I run this macro the line "obj.Export "C:\test\Test2.csv", "," , , False" fails. Someone know why?

sub Export

ActiveDocument.ClearAll True

set Obj = ActiveDocument.GetSheetObject("CH14")

obj.Export "C:\test\Test2.csv", "," , , False

ActiveDocument.reload

end sub



1 Reply
raghavsurya
Partner
Partner

Hi Jakob,

Please find below one of the macros I got it from community posts.... which works perfectly for me.

Sub TestIt
SheetIt "C:\Users\raghavendra.s\Desktop\test.xls","OldSheetname","TB01","NewSheetname"
End sub

function SheetIt(ExcelDoc,SheetName,ChartName,Category)
set XLS = createobject("Excel.Application")
XLS.Visible = True
Set Workbook = XLS.Workbooks.Open(ExcelDoc)
Set Worksheet = Worksheets.xls(NewSheetname)
Worksheet.Activate
set obj = ActiveDocument.getsheetobject(TB01)
obj.CopyTableToClipboard true
Worksheet.paste
Worksheet.cells.select
Worksheet.cells.mergecells = false
Worksheet.Cells.EntireRow.RowHeight = 12.75
Worksheet.Cells.EntireColumn.AutoFit
Worksheet.name = Category
end function

Hope this helps.

Regards,

Raghav