Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
snehamahaveer
Creator
Creator

Export to PPT

Hi Everyone,

I am very excited to create a ppt presentation that holds most of my qlikview charts at a touch of a button. However, I am facing difficulties exporting charts from various sheets. It is easiest to export data from one sheet ( the active sheet having the export button).

Could someone point out my mistake here?

My macro is given below.

Sub ExportPPT
Set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True
Set objPresentation = objPPT.Presentations.Add
Set PPSlide = objPresentation.Slides.Add(1,11)
set up = ActiveDocument.GetApplication.GetUserPreferences
up.ChartUseCapNBorder = True
ActiveDocument.GetApplication.SetUserPreferences up
with objPresentation.Slides(1).Shapes(1)
.TextFrame.TextRange = "PURCHASE HISTORY" 'gives a heading for the slide
end with
ActiveDocument.Sheets("SH05").Activate
ActiveDocument.GetSheetObject("CH40").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.PasteSpecial(PasteHTML) 'slide 1
.Left = 100 'size of the image on slide
.top = 100
.width=500
.height=200
end with
ActiveDocument.Sheets("SH05").Activate
ActiveDocument.GetSheetObject("CH66").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.PasteSpecial(PasteHTML) 'slide 1
.Left = 100 'size of the image on slide
.top = 300
.width=500
.height=200
end with
ActiveDocument.GetSheetObject("TX08").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.PasteSpecial(PasteHTML) 'slide 1
.Left = 15 'size of the image on slide
.top = 10
.width=25
.height=35
end with
Set PPSlide = objPresentation.Slides.Add(2,11)
ActiveDocument.Sheets("SH07").Activate
set up = ActiveDocument.GetApplication.GetUserPreferences
up.ChartUseCapNBorder = True
ActiveDocument.GetApplication.SetUserPreferences up
with objPresentation.Slides(2).Shapes(1)
.TextFrame.TextRange = "TOP PRODUCTS PURCHASED & SERVICED" 'gives a heading for the slide
end with
ActiveDocument.Sheets("SH07").Activate
ActiveDocument.GetSheetObject("CH67").CopyBitmapToClipboard
with objPresentation.Slides(2).Shapes.Paste ' slide 2
.Left = 25 'size of the image on slide
.top = 100
.width=500
.height=200
end with

ActiveDocument.GetSheetObject("TX08").CopyBitmapToClipboard

with objPresentation.Slides(2).Shapes.PasteSpecial(PasteHTML) 'slide 2

.Left = 15 'size of the image on slide

.top = 10

.width=25

.height=35

end with

Set PPSlide = Nothing
Set PPPres = Nothing
End sub

3 Replies
suniljain
Master
Master

Can you please post QlikView  Application with dummy data set ?. Script looks correct .

HirisH_V7
Master
Master

Hi,


Try this Macro,

Changes to be done your object id's,There mentioned in Comments check it,

Sub ppt

'An array with the objects you want to export to powerpoint

Dim myArray(4)

myArray(0) = "CH01"

myArray(1) = "CH02"

myArray(2) = "CH03"

myArray(3) = "CH04"

myArray(4) = "CH05"

'Create ppt object

Set objPPT = CreateObject("PowerPoint.Application")

objPPT.Visible = True

Set objPresentation = objPPT.Presentations.Add

'Apply a template if you want one

'objPresentation.ApplyTemplate _

  '  ("C:\mytemplate.potx")

'For each object in the array create a new slide and paste it.

For each item in myArray

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

ActiveDocument.GetSheetObject(item).CopyBitmapToClipboard

'PPSlide.Shapes.Paste

with PPSlide.Shapes.Paste

  .Width=448

  .Height=288

end with

Next

'Clean up

Set PPSlide = Nothing

Set PPPres = Nothing

Set PPApp = Nothing

End Sub

else,if you want run your macro code ,Can you tell what is exact error your seeing when your running the macro export!

post sample if possible,

Hope this helps,

PFA,

Hirish

HirisH
“Aspire to Inspire before we Expire!”
snehamahaveer
Creator
Creator
Author

Hi,

I want to export maximum of 2 charts in one slide and also, name the slide. This is the macro I use. I am able to export the charts on the active tab but when charts are to be extracted from various tabs my ppt just freezes. No error message is displayed.

Thanks for your help.