15 Replies Latest reply: May 31, 2016 8:20 AM by xia ZHU RSS

    Exporting Table to Excel with help of macro

    KUMAR RISHIKESH

      Hi,

       

      I have a straight table in a dashboard. This dashboard is client specific and is refreshed for one client at a time. I have a macro which exports the Straight table as excel. This is working fine.

      I enhanced this dashboard and can run for all clients at one go using a excel file as input with client name.

      But now only data for the last run client is being exported by the macro. Ideally, I want after each client run the export should happen.

      Can any one help me out with this.

       

      Qlikview code:

      Client:

      LOAD Client

      FROM

      [.\EXCEL FILES\client_list.xlsx]

      (ooxml, embedded labels, table is Client);

      for i = 0 to noofrows('Client')-1

           let vClient = peek('Client', $(i), 'Client');

       

      Data:

      Load * from $(vClient) (txt, utf8, embedded labels, delimiter is '~', no eof) ;

       

      Macro:

      Function ExportChart()

      ActiveDocument.GetApplication.WaitForIdle

      ActiveDocument.GetSheetByID("SH01").Activate

         

      output_dir="\\milkyway\internal\Business Value Consulting\CV Scorecards\Scorecard_Simplification\Working DND\DATA\QVW\Export\"

      vClient=ActiveDocument.Variables("vClient").GetContent.String

      Filename=vClient&".xls"

      set obj = ActiveDocument.GetSheetObject("CH21") 

      obj.export (output_dir & Filename),"~"

      end Function