Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help with Macro

Hello everybody,

I'm very sad. I had a solution for my problem, but then my pc is crashed without saving anything

I try to export one table of QlikView to an excel-file in an already existed sheet called "data sheet" because in the other sheets of the file are expressions which are used cells of this one. So I can't delete the existed sheet and add a new one with the same name. This doesn't work; the error is reference! then.

The following code opens the excel-file, saves it and closes it, but it doesn't add the table

sub ExportExcel()


Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = true


Set xlDoc = xlApp.Workbooks.Open("C:\test.xls")
xlApp.DisplayAlerts = false

Set SheetObj = ActiveDocument.GetSheetObject("CH09")     
SheetObj.CopyTableToClipboard true     

Set xlSheet = xlDoc.Sheets("data sheet")
xlDoc.Sheets("data sheet").Range("A1").Select
xlDoc.Sheets("data sheet").Paste

xlApp.ActiveWorkBook.Save
xlDoc.Close


xlApp.Quit

End sub

What's wrong with it?

Regards vicky

0 Replies