Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Example:
I have data from different country.
I would like to spilit the data based on country and save the file based on Country using Macro.
sub Country_Reduce
set vfield=ActiveDocument.Fields("Country")
vfield.select "USA", true
ActiveDocument.ReduceData false
ActiveDocument.SaveAs "C:\Users\USA.QVW"
end sub
the above statement works for one country.If I need to implement the same for multiple countrywise -I tried to loop .
It didn't work.
Advance thanks for help.
Hi
You can done this with use of for next loop
Just alter you coding like below .
sub Country_Reduce
set vfield=ActiveDocument.Fields("Country").GetPossibleValues()
for vselectvalue=0 to vfield.count-1
ValueToSelect = vfield.Item(vselectvalue).Text
msgbox ValueToSelect
ActiveDocument.Fields("Country").select ValueToSelect
ActiveDocument.ReduceData false
ActiveDocument.SaveAs "D:\san\"&ValueToSelect&".QVW"
next
end sub
here you can change the saveas path but dont change the variable because the variable have the list of country name.
Regards
Ashok