Qlik Community

Ask a Question

QlikView Administration

Discussion Board for collaboration on QlikView Management.

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: 
Not applicable

Selections shown when export to excel option?

When you print or export to a pdf, the current selections are shown too.  When I export to excel, the current selections are not shown.  Can we, and if so how, can we export to excel with the current selections attached too?

Thanks!

1 Solution

Accepted Solutions
m_woolf
Master II
Master II

in the code you need to change the "CH252" to the object ID for the chart you want to export

in the code you need to change the "CS12" to the object ID for the selection box you want to export

View solution in original post

16 Replies
m_woolf
Master II
Master II

This can be done with a macro:

sub ExportWithSelections
      Set XLApp = CreateObject("Excel.Application")
      XLApp.Visible = True 
      Set XLWorkbook = XLApp.Workbooks.Add
      Set XLSheet = XLWorkbook.sheets("Sheet1")
      XLSheet.Range("A3").Select

rem ** copy full chart details to clipboard **
      ActiveDocument.GetSheetObject("CH252").CopyTableToClipboard false
      XLSheet.Paste ' -4163    'values

      XLSheet.Range("J2").Select

rem ** put current selection in J2 **
      ActiveDocument.GetSheetObject("CS12").CopyTableToClipboard true
      XLSheet.Paste ' -4163    'values
      XLApp.Selection.WrapText = False

      set XLSheet = nothing
      set XLWorkbook = nothing
      set XLApp = nothing

end sub

Not applicable
Author

The only thing is where do I put this macro?  If someone is opening the QV document through a web portal, will they beable to use this macro?  Can I incorporate it with the QV document so that it will append the selections no matter the version of excell someone open into?

m_woolf
Master II
Master II

Tools|Edit Module opens the macro editor.

This macro requires System Access.

It will work if your users are opening with the IEPlugin. I don't know if it will work with Ajax.

Once the macro is entered. You need to create a button object and set the button acrtion to run the macro.

Not applicable
Author

Sorry mwoolf.  I've not made a macro in QV before.  When I add it and create a button and set the action of the button to Run Macro with the name of the macro I created, it only opens the edit module window with the macro code. 


What am I missing?

m_woolf
Master II
Master II

in the code you need to change the "CH252" to the object ID for the chart you want to export

in the code you need to change the "CS12" to the object ID for the selection box you want to export

View solution in original post

Not applicable
Author

Thanks mwoolf.  That does work, but what I really want is just when people right click on any chart and choose to export in excel, that it will export with selections. 

I know these options exist under document properties.  But it doesn't work when I try to download a chart from a dashboard in production.

Not applicable
Author

Hi Brandon,

Did you try the following on the prod server? : User preferences-Exports-Selection Stamps in Exports- On BIFF exports- checked

Not applicable
Author

We're still using 10.4, so we don't have Selections Stamps but rather Selections for Current selection box.  Clicking those two boxes doesn't work with the production server when you right-click and export to excel though at least not for "Open with AJAX zero footprint" or when you do it with a different browser (It does work with IE plugin.)

natebrunner
Contributor III
Contributor III

Did you ever come up with a solution to this? I'm wondering the same thing if I can get the selections to appear when sending a table box of data to Excel.