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: 
soha1902
Creator
Creator

How to export 2 sheet object into one PPT slide

Hi All,

I want to export my chart into PPT. I have below requirement:

1.png

When I click on Export to PPT button chart 1 and Pivot table which appears below of chart 1 should be export to one slide and Chart 2 and pivot table which appears below of chart 2 should be export in second slide, like this I need to export 10 charts.

Please help me regarding this. I know I need to write MACRO for this. Anyone who have the good MACRO knowledge please help me.

Thanks

1 Solution

Accepted Solutions
beck_bakytbek
Master
Master

Hi Soha,

this my example, that allows me to export a few couple of objects, try to implement my example:

 

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 = "to powerpoint from access_point"
.Left = 100
.top = 15
.width=600
.height=20
end with

ActiveDocument.Sheets("SH02").Activate

ActiveDocument.GetSheetObject("CH04").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.PasteSpecial(PasteHTML)
.Left = 100
.top = 45
.width=100
.height=150
end with
ActiveDocument.GetSheetObject("CH05").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.Paste
.Left = 100
.top = 200
.width=100
.height=150
end with
ActiveDocument.GetSheetObject("CH06").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.Paste
.Left = 100
.top = 355
.width=100
.height=150
end with
ActiveDocument.GetSheetObject("CH07").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.Paste
.Left = 400
.top = 45
.width=100
.height=150
end with

ActiveDocument.GetSheetObject("CH08").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.Paste
.Left = 400
.top = 200
.width=100
.height=150
end with

ActiveDocument.GetSheetObject("CH09").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.Paste
.Left = 400
.top = 355
.width=100
.height=150
end with

ActiveDocument.GetSheetObject("TX12").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.Paste
.Left = 408
.top = 510
.width=80
.height=25
end with

Set PPSlide = Nothing
Set PPPres = Nothing

End sub

i hope that helps

beck

 

View solution in original post

4 Replies
beck_bakytbek
Master
Master

Hi Soha,

try this:

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 = "to powerpoint"
.Left = 100
.top = 15
.width=600
.height=20
end with

ActiveDocument.Sheets("YourSheet").Activate

ActiveDocument.GetSheetObject("YourChartID").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.PasteSpecial(PasteHTML)
.Left = 100
.top = 45
.width=100
.height=150
end with
ActiveDocument.GetSheetObject("YourChartID").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.Paste
.Left = 100
.top = 200
.width=100
.height=150
end with

Set PPSlide = Nothing
Set PPPres = Nothing

End Sub

I hope that helps

beck

soha1902
Creator
Creator
Author

Hi Beck,

Thanks for your reply..Your code will export one slide.I want this to be continue to be other charts also. It will automatically add more slides as per charts available. also please see below screenshot

2.png

Charts objects are overlapping in the PPT. I want it will be display inside the PPT with similar width of both the charts. Please help me.

Thanks

beck_bakytbek
Master
Master

Hi Soha,

this my example, that allows me to export a few couple of objects, try to implement my example:

 

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 = "to powerpoint from access_point"
.Left = 100
.top = 15
.width=600
.height=20
end with

ActiveDocument.Sheets("SH02").Activate

ActiveDocument.GetSheetObject("CH04").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.PasteSpecial(PasteHTML)
.Left = 100
.top = 45
.width=100
.height=150
end with
ActiveDocument.GetSheetObject("CH05").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.Paste
.Left = 100
.top = 200
.width=100
.height=150
end with
ActiveDocument.GetSheetObject("CH06").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.Paste
.Left = 100
.top = 355
.width=100
.height=150
end with
ActiveDocument.GetSheetObject("CH07").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.Paste
.Left = 400
.top = 45
.width=100
.height=150
end with

ActiveDocument.GetSheetObject("CH08").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.Paste
.Left = 400
.top = 200
.width=100
.height=150
end with

ActiveDocument.GetSheetObject("CH09").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.Paste
.Left = 400
.top = 355
.width=100
.height=150
end with

ActiveDocument.GetSheetObject("TX12").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.Paste
.Left = 408
.top = 510
.width=80
.height=25
end with

Set PPSlide = Nothing
Set PPPres = Nothing

End sub

i hope that helps

beck