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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Copy Table is not working for filtered data in macro and manually

I am writing a macro that exports my pivot table to Excel by copying it and pasting it into a new Excel sheet. When I run the Macro it works on all instances I need, however 1 specific filter causes the macro to fail at the CopyTableToClipboard function without giving an error message as to why. When I right click and copy the Table Data Area and try pasting it in excel manually, it does not work either for this specific filter.

If I use CopyBitmapToClipboard or the built in send to excel option, both work perfectly fine but for some reason copy table does not.

Here is the Macro I am using:

Sub ET

Set XLApp = CreateObject("Excel.Application")

Set XLDoc = XLApp.Workbooks.Add

XLApp.Visible=True

ActiveDocument.GetSheetObject("CH01").CopyTableToClipboard true

XLDoc.Sheets(1).Paste()

ActiveDocument.GetSheetObject("CH17").CopyTableToClipboard true

XLDoc.Sheets(1).Paste()

XLApp.Visible=True

End Sub

Here is the failure I get in the case described above.

module_fail.PNG

I have searched for so long in the forum but could not find a solution to my problem.

In Layout, I have Copy/Clone checked. Same for Document > Security, all possible options are checked.

I also do not want to use the normal send to Excel feature as I have additional functionality to implement.

QlikView 11.20 SR16

Any ideas on why this is happening?

1 Reply
m_woolf
Master II
Master II

Your code works for me.

Can you post a sample qvw that shows the problem?