Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Export to PPT Subscript out of range Error

Hi All,

I created Macro to export Qlikview objects to Power Point Presentation, it can export the chart to PPT when I test in module with two objects,but when i try to export with 3rd object its giving error -- Subscript out of range: '[number: 2]'

Sub Export_ppt

Dim myArray(1)

myArray(0) = "LB04"

myArray(1) = "LB06"

myArray(2) = "CH02"

Set objPPT = CreateObject("PowerPoint.Application")

objPPT.Visible = True

Set objPresentation = objPPT.Presentations.Add

For count = 0 to ubound(MyArray)

Set PPSlide = objPresentation.Slides.Add(1,11)

ActiveDocument.GetSheetObject(MyArray(count)).CopyBitmapToClipboard

PPSlide.Shapes.Paste

Next

Set PPSlide = Nothing

Set PPPres = Nothing

Set PPApp = Nothing

End Sub

Please any help will be appreciated

Thanks

Nitha

1 Solution

Accepted Solutions
jerem1234
Specialist II
Specialist II

I think you may have forgotten to change the the array limit:

Dim myArray(2)

Hope this helps!

View solution in original post

2 Replies
jerem1234
Specialist II
Specialist II

I think you may have forgotten to change the the array limit:

Dim myArray(2)

Hope this helps!

Anonymous
Not applicable
Author

I missed it

Thanks Jerem

Sub Export_ppt

Dim myArray(2)

myArray(0) = "LB04"

myArray(1) = "LB06"

myArray(2) = "CH02"

Set objPPT = CreateObject("PowerPoint.Application")

objPPT.Visible = True

Set objPresentation = objPPT.Presentations.Add

For count = 0 to ubound(MyArray)

Set PPSlide = objPresentation.Slides.Add(1,11)

ActiveDocument.GetSheetObject(MyArray(count)).CopyBitmapToClipboard

PPSlide.Shapes.Paste

Next

Set PPSlide = Nothing

Set PPPres = Nothing

Set PPApp = Nothing

End Sub