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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Can't make macro to export to excel but can use native send to excel button

Hello!

I have made several macros before and I am sure I am doing it right but I can't seem to make a macro to send a chart over to excel. The chart is very big (around 80 columns) so it doesn't surprise me it doesn't work but when I click on the "Send to Excel" button on the caption of the chart it works.  Is there a reason why the macro isn't working?  For simplicity sakes I tried to export only the chart.

Sub Detail()

    Set XLApp = CreateObject("Excel.Application")

    XLApp.Visible = false

    Set XLDoc = XLApp.Workbooks.Add

XLDoc.Sheets.Add.Name= "Detail Report"

     DET = "Detail Report"

        ActiveDocument.GetSheetObject("CH17").CopyTableToClipboard true

            XLDoc.Sheets(DET).Range("A" &  8).Select

            XLDoc.Sheets(DET).Paste

    XLApp.Visible = True

  

  

End Sub

10 Replies
m_woolf
Master II
Master II

Try the waitforidle line before the copytable to clipboard line.

You don't want to copy the table until it is done rendering.