Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

PPT parameters

Hey,

I am creating an export from qlikview to PowerPoint.

One of those ppt will be having over 40 slides, each of them will be exactly the same just filtered by different country.

Is there any way to write a Sub and use a country name as parameter and then just call that sub ?

the trouble I have is that if I have following Sub:

sub CreateCountry(slide_nr, CountryName)

Set PPSlide = PPPres.Slides(n)
set s=ActiveDocument.Sheets("SH11")
ActiveDocument.Sheets("SH11").Activate
ActiveDocument.GetApplication.WaitForIdle
Activedocument.fields("Country Project").select "CountryName"
ActiveDocument.GetSheetObject("CH09").CopyBitmapToClipboard
PPSlide.Shapes.Paste
call Fix_Picture_Size(0.49,0.1,0.4,0.2,PPSlide.Shapes(PPSlide.Shapes.Count),PPSlide.Master.Width)
Activedocument.fields("Country Name").Clear

End Sub

And then I call this Sub:

call CreateCountry(1, "United Kingdom")

It doesn't work...

Any ideas what I got wrong?

Thanks

1 Solution

Accepted Solutions
marcus_sommer

I think the reason aren't the call or the parameters - something else caused this error. I suggest you put some msgbox into the script to find out until which point the routine(s) runs.

- Marcus

View solution in original post

11 Replies
marcus_sommer

Have a look on this: Automated PowerPoint Presentation Extraction.

- Marcus

Not applicable
Author

Hey,

Yeah it does the job, but this is not exactly what I ment.

I just want to know how to reference to the parameter of the function in

Activedocument.fields("Country Project").select "CountryName"

so it will actually do the filtering.

Any ideas?

marcus_sommer

In this case it should look more like:

sub CreateCountry(slide_nr, CountryName)

Set PPSlide = PPPres.Slides(slide_nr)
set s=ActiveDocument.Sheets("SH11")
ActiveDocument.Sheets("SH11").Activate
ActiveDocument.GetApplication.WaitForIdle
Activedocument.fields("Country Project").select CountryName
ActiveDocument.GetSheetObject("CH09").CopyBitmapToClipboard
PPSlide.Shapes.Paste
call Fix_Picture_Size(0.49,0.1,0.4,0.2,PPSlide.Shapes(PPSlide.Shapes.Count),PPSlide.Master.Width)
Activedocument.fields("Country Name").Clear

End Sub

- Marcus

Not applicable
Author

Ok, Thanks.

And how do I call that sub in the code for United Kingdom?

marcus_sommer

In this way like you have done it:

call CreateCountry(1, "United Kingdom")

Not applicable
Author

I thought so, but it doesn't work..

So here is my Sub:

Sub CreateCountry(slide_nr, CountryName)
'****New York CB&S
'Rag status

Set PPSlide = PPPres.Slides(slide_nr)
set s=ActiveDocument.Sheets("SH11")
ActiveDocument.Sheets("SH11").Activate
ActiveDocument.GetApplication.WaitForIdle
Activedocument.fields("Country Project").select CountryName
ActiveDocument.GetSheetObject("CH09").CopyBitmapToClipboard
PPSlide.Shapes.Paste
call Fix_Picture_Size(0.49,0.1,0.4,0.2,PPSlide.Shapes(PPSlide.Shapes.Count),PPSlide.Master.Width)
Activedocument.fields("Country Name").Clear

End Sub

Here is how I call it:

call CreateCountry(1,"New York CB&S")

it is just opening the Macro Window and does nothing.

Do you know whats wrong?

marcus_sommer

Yes, if this is the complete code then there are some missing things like createobject() - this meant you need at first create a powerpoint-instance. For this have a look on the link from my first answer.

- Marcus

Not applicable
Author

no it is not a complete code, I have the bit to open powerpoint and if I do the same without Sub it works perfectly.

So the problem needs to be in the way how I call the parameters?

Maybe with quotation signs?

But I already tried different configuration and nothing works.

marcus_sommer

Maybe you tried it in this way:

slide_nr = 1

CountryName = "New York CB&S"

call CreateCountry(slide_nr, CountryName)

and used instead a sub-routine a public function. I have excactly such callings which work fine.

- Marcus