Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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
mwoolf
Honored Contributor II

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

Your code works for me.

Can you post a sample qvw that shows the problem?

Community Browser