Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Export QV objects to ppt template

Colleagues, good day!

My model has macro which export charts to new power point presentation.

Tell me please, is there in qv macro ability to export objects into ppt template (not creating new presentation) ?

There're test model and necessary ppt template in attachment.

Thanks.

1 Solution

Accepted Solutions
HirisH_V7
Master
Master

Hi,

Sub ExportPPT 

Set objPPT = CreateObject("PowerPoint.Application") 

objPPT.Visible = True 

Set objPresentation = objPPT.Presentations.open("YourPath\ppt.pptx")'file Path

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

ActiveDocument.GetSheetObject("CH02").CopyBitmapToClipboard 

PPSlide.Shapes.Paste 

PPSlide.Shapes(PPSlide.Shapes.Count).Top = 150 'This sets the top location of the image 

PPSlide.Shapes(PPSlide.Shapes.Count).Left = 15 'This sets the left location 

PPSlide.Shapes(PPSlide.Shapes.Count).Width = 240 

PPSlide.Shapes(PPSlide.Shapes.Count).Height = 250 

 

 

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

ActiveDocument.GetSheetObject("CH02").CopyBitmapToClipboard 

PPSlide.Shapes.Paste 

PPSlide.Shapes(PPSlide.Shapes.Count).Top = 150 'This sets the top location of the image 

PPSlide.Shapes(PPSlide.Shapes.Count).Left = 15 'This sets the left location 

PPSlide.Shapes(PPSlide.Shapes.Count).Width = 100 

PPSlide.Shapes(PPSlide.Shapes.Count).Height = 200 

 

Set PPSlide = Nothing 

Set PPPres = Nothing 

Set PPApp = Nothing 

End Sub 

Thanks,

Hirish

HirisH
“Aspire to Inspire before we Expire!”

View solution in original post

24 Replies
petter
Partner - Champion III
Partner - Champion III

Well there is nothing stopping you from storing the PowerPoint presentation as a POTX-file (PowerPoint Template). You can either do it manually with File Save As and select it or you can do it directly in your macro. The PowerPoint object model supports that by using the method SaveAs on the presentation object.

Anonymous
Not applicable
Author

Thanks!

My answer was - how i can export objects directly by macro???

beck_bakytbek
Master
Master

Hi andrey try this:

Sub ExportPPT_1
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 = "Test für PowerPoint Seite 1"
.Left = 100
.top = 15
.width=500
.height=20
end with

ActiveDocument.Sheets("SH01").Activate

ActiveDocument.GetSheetObject("TX01").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.PasteSpecial(PasteHTML)
.Left = 100
.top = 45
.width=100
.height=160
end with
ActiveDocument.GetSheetObject("TX02").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.Paste
.Left = 100
.top = 200
.width=100
.height=160
end with
ActiveDocument.GetSheetObject("TX03").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.Paste
.Left = 100
.top = 355
.width=100
.height=160
end with
ActiveDocument.GetSheetObject("TX04").CopyBitmapToClipboard
with objPresentation.Slides(1).Shapes.Paste
.Left = 400
.top = 45
.width=100
.height=160
end with

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

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

ActiveDocument.GetSheetObject("TX09").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

if that helps you, let me know

Beck

kkkumar82
Specialist III
Specialist III

Hi Beck,  Will the above code work from access point by pressing a button.  My doubt here is macros which creates objects like Excel, Powerpoint will work from access point.  Thanks Kiran
Not applicable
Author

HirisH_V7
Master
Master

Hi,

Check now,

PFA,

Hirish

HirisH
“Aspire to Inspire before we Expire!”
beck_bakytbek
Master
Master

Hi Kiran, i understand your doubt, but i use These code in Access Point, and it does work. of cource in Internet Explorer plugin-Modus.

if you have any question, i can send my example.

Beck

HirisH_V7
Master
Master

Hi ,

  • I tried over access point but not working no response (IE Plugin)

  • I already enabled macros on QMC too.

  • Its working fine on local qv desktop .

Can you tell me have i missed anything.

-Hirish

HirisH
“Aspire to Inspire before we Expire!”
kkkumar82
Specialist III
Specialist III

Ok, you say it is possible through only IE but not Chrome or FireFox.  I earlier tried Excel export of some bar charts but was not successful even with IE plugin.  I think it would be glad if you can create a post for IE what are the steps to achieve using a sample Excel and PPT export.  Thanks Kiran