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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

export to excel with condition using macros

Hi,

I want export to my datas to excel using macros but i want export my data with some condition

for example I have an table with date,name and data in that i have date from 11-02-2014 to 21-02-2014 my condition is  i want to export the data which is after 16-02-2014 i.e.,from 16-02-2014 to 21-02-2014.

I have attached a sample qvw file with this mail please help me..

Thanks in advance...

1 Solution

Accepted Solutions
gonzaloruizgonz
Partner - Creator
Partner - Creator

Sure, here you are.

View solution in original post

11 Replies
gonzaloruizgonz
Partner - Creator
Partner - Creator

You can probabily use this macro:

Sub sat

set obj = ActiveDocument.GetSheetObject("CH01")

obj.ExportEx "C:\test.qvd", 4      

end sub

där 4 = QVD You need to have 5 how is excel.

Sub sat

set obj = ActiveDocument.GetSheetObject("CH01")

obj.ExportEx "C:\test.qvd", 5   

end sub

BR //Gonza

Not applicable
Author

Thanks but I need a data only from 16-02-2014 to 21-02-14 and I don't need other dates and all if i export to excel means i want data like this..

DateDataName
16-02-1471F
17-02-142G
18-02-14114H
19-02-1416I
20-02-1495J
21-02-1446K
giakoum
Partner - Master II
Partner - Master II

and add the condition as follows (example):

ActiveDocument.Fields("Month").Select ">4"

ActiveDocument.Fields("Month").ToggleSelect "<8"

Not applicable
Author

No its not working how can i get a range between this or what is the macro to get a specific date in a field..?

gonzaloruizgonz
Partner - Creator
Partner - Creator

Yes, you can put your date in a variable and use them in a setanalys exprexion on a pareto select inside en action. There is probabily more ways to do it, search for "date select", you will probabily found a lot of stuff.

//Gonza

Not applicable
Author

No I am asking in macro neither not in set analysis nor pareto im asking for a vb scripts..?and export to excel in macro with condition..

gonzaloruizgonz
Partner - Creator
Partner - Creator

Ohhhh  , you can probabily add one of the follow rows into the macro:

ActiveDocument.Fields("date").Select ("(16-02-2014|21-02-2014)")

or

ActiveDocument.RecallDocBookmark "selection"

I used the second one the i use a bookmark.

BR//Gonza

Not applicable
Author

no its not working can you give some other examples ..

gonzaloruizgonz
Partner - Creator
Partner - Creator

Sure, here you are.