Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
My requirement is when I click a button lets say 'Generate PPT' qlikview engine will select each values in country field one by one and it will send all charts to ppt.
i want to do this by using for loop in macro.
I am able to generate ppt for all country but not able implementing forloop to select country name automatically.
I have added for loop in macro but when running macro. One ppt is opening and qlikview application got hanged.
Please help me regarding this. I have attached macro code which i am using.
Regards
Tripati
Have a look at the attached macro. Just copy an paste into your module.
but there are two things you will have to take care of:
1. create Qlikview Variable (Settings-->Variable Overview-->add)
vFinal=GetFieldSelections(PasteNameYourCountryFieldHere)
2 adjust this path according your local environment (This should be the Directory in which you want to save the reports):
this should loop through your countryfield and creates your report for all countries!
hope this helps
You should find a macro on here which will allow you to wrap your code in a selections loop, maybe just try it with a couple to start with.
I've certainly done things in the past which looped 100+ fields into excel documents so you should be ok!
https://community.qlik.com/docs/DOC-4870
Please remember to mark this as helpful or the correct answer if I have helped you or answered your question.
Dear Frank Hartman,
Sub Exportppt
Set PPApp = CreateObject("Powerpoint.Application")
PPApp.Visible = True ' Create a presentation
Set PPPres = PPApp.Presentations.Add
Set PPSlide = PPPres.Slides.Add(1, 1)
PPSlide.Shapes(1).Delete ' removes the title
PPSlide.Shapes(1).Delete ' removes the text box
ActiveDocument.GetSheetObject("TX6362").CopyBitmapToClipboard
ActiveDocument.GetApplication.WaitForIdle
with PPSlide.Shapes.Paste
.Left = 300
.Top = 25
end with
ActiveDocument.GetSheetObject("CH1708").CopyBitmapToClipboard
ActiveDocument.GetApplication.WaitForIdle
with PPSlide.Shapes.Paste
.Left = 50
.Top = 100
end with
Above is the code which i am using to export chart and textbox.
Now i have a COUNTRY field in application ,My requirement is when I click a button value of country will be automatically selected and save as different name in system.
I have for loop coding with me but it is not working when i try to implement.
Sub ExportCharts()
set field1Values = ActiveDocument.Fields("<your first field here>").GetPossibleValues
chartList = ActiveDocument.ActiveSheet.GetGraphs
for i = 0 to field1Values.Count - 1
for j = 0 to field2Values.Count - 1
for k = 0 to field3Values.Count - 1
ActiveDocument.ClearAll()
ActiveDocument.Fields("<your first field here>").Select field1Values.Item(i).Text
ActiveDocument.Fields("<your second field here>").Select field1Values.Item(j).Text
ActiveDocument.Fields("<your third field here>").Select field1Values.Item(k).Text
' ... export operations here...
next
next
next
end Sub
Please let me know how to implement above looping code into the application.
Regards
Tripati
is this what you want to achieve?
If yes, then try attached sample.
Or do you need to export these Objects into one Powerpointdocument?
Hope this helps
If you need to export all the objects into a single document, then use attached code.
Dear Frank,
Thanks for your solution,
I have multiple chart to be exported to PPT by selecting country one after another automatically by qlikview.
I have attached the VB script code where i have mentioned all Chartid and Textbox id which need to be exported to PPT for each country
and stores in a specific location in system like
country1.ppt
country2.ppt
Best Regards
Tripati
Have a look at the attached macro. Just copy an paste into your module.
but there are two things you will have to take care of:
1. create Qlikview Variable (Settings-->Variable Overview-->add)
vFinal=GetFieldSelections(PasteNameYourCountryFieldHere)
2 adjust this path according your local environment (This should be the Directory in which you want to save the reports):
this should loop through your countryfield and creates your report for all countries!
hope this helps
3. here has to be the correct CountryFieldname:
Dear Frank,
Thanks for your solution .Its working fine.
Regards
Tripati