Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Exporting Table to Excel with help of macro

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

15 Replies
syukyo_zhu
Creator III
Creator III

can you run "C:\Program Files\QlikView\Qv.exe" -l -vvClient='$(vClient)' "\\milkyway\internal\Business Value Consulting\CV Scorecards\Scorecard_Simplification\Working DND\DATA\QVW\POS - Rishi - Copy.qvw on commande ligne.

and send to me the result.


pay attention "C:\Program Files\QlikView\Qv.exe" -l -vvClient      not /l/v

macro.png

Not applicable
Author

When I am running this through command prompt, then it is running fine. But from inside the Qvw1 where we are calling it through command line it is not working.

Not applicable
Author

Hi Xia,

I got this running. Error was due to incorrect quoting for cmd.exe for multiple arguments.

When we are executing directly into cmd.exe then

"C:\Program Files\QlikView\Qv.exe"/l/v vClient='$(vClient)' "\\milkyway\internal\Business Value Consulting\CV Scorecards\Scorecard_Simplification\Working DND\DATA\QVW\POS - Rishi - Copy.qvw"

is running fine.

But when we are calling it through the qvw the we should use

execute cmd.exe /c ""C:\Program Files\QlikView\Qv.exe" -r -vvClient=$(vClient) "\\milkyway\internal\Business Value Consulting\CV Scorecards\Scorecard_Simplification\Working DND\DATA\QVW\POS - Rishi - Copy.qvw"";

We need to enclose the argument into quotes so that it runs.

Thanks Xia for your help.

Regards,

Rishikesh

syukyo_zhu
Creator III
Creator III

I'm sorry, but i don't know how can i help you.

Not applicable
Author

It is working now Xia. Thanks

syukyo_zhu
Creator III
Creator III

Great.