Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
nikhilgandhi715
Contributor III
Contributor III

Change the Image size after exporting to powerpoint

Hi All,

I have a macro which exports chart images to powerpoint slides. The problem I am facing here is that the Images are getting a bit off the slide. Is there a way I can set the size of the image while exporting to powerpoint or can set it to autofit in the slide.

Thanks in advance.

Nikhil

9 Replies
m_woolf
Master II
Master II

Yes, but the method would depend on your macro code. If you are pasting the object image into PowerPoint, the code to resize the image is something like:

    ActiveDocument.GetSheetObject("CH133").CopyBitmapToClipboard

    PPSlide.Shapes.Paste.Select   

    PPApp.ActiveWindow.Selection.ShapeRange.Top = 54         'This line sets the top location of the image

    PPApp.ActiveWindow.Selection.ShapeRange.Left = 20         'This line sets the left location

'These lines set the image Width and Height (if the image is set to Lock Aspect ratio, you need to set only one of these

    PPApp.ActiveWindow.Selection.ShapeRange.Width = 676

    PPApp.ActiveWindow.Selection.ShapeRange.Height = 406

nikhilgandhi715
Contributor III
Contributor III
Author

Hi Michael,

Thanks for the reply.

I had done the same; however it was an issue with the resolution of my system. I tried it on another machine and it worked fine.

sathishkumar_go
Partner - Specialist
Partner - Specialist

HI Michael,

I am getting the error

 

Object required: 'PPApp'

-Sathish

m_woolf
Master II
Master II

I notice that you said back in March that this code was working correctly.

What has changed?

sathishkumar_go
Partner - Specialist
Partner - Specialist

Hi Michael,

Please find the below mentione macro which i am using.

 

Sub Test1
Set objPPT = CreateObject("PowerPoint.Application")

objPPT.Visible = True

Set objPresentation = objPPT.Presentations.Add
For i = 0 To ActiveDocument.NoOfSheets - 1
Set PPSlide = objPresentation.Slides.Add(1,1)
ActiveDocument.GetSheetObject("CH2178").CopyBitmapToClipboard
PPSlide.Shapes.Paste.Select

PPApp.ActiveWindow.Selection.ShapeRange.Top = 54 'This line sets the top location of the image

PPApp.ActiveWindow.Selection.ShapeRange.Left = 20 'This line sets the left location

'These lines set the image Width and Height (if the image is set to Lock Aspect ratio, you need to set only one of these

PPApp.ActiveWindow.Selection.ShapeRange.Width = 676

PPApp.ActiveWindow.Selection.ShapeRange.Height = 406


Next

Set PPSlide = Nothing

Set PPPres = Nothing

End sub

-Sathish

m_woolf
Master II
Master II

When you create your PowerPoint object, you name it objPPT.

In my code snippet, I was using the name PPApp. If you change PPApp to objPPT, life should be good.

sathishkumar_go
Partner - Specialist
Partner - Specialist

HI Michael,

Thanks for your reply. Now its working fine.

I am facing one more issue. while exporting into ppt, some of the qlikview object data is big on that time i want to split the object and export into different slides. is it possible?

Sathish

m_woolf
Master II
Master II

If you are talking about text data (tables, straight tables or pivottables), yes.

You could apply a filter in the macro to select a subset of records and export to ppt.

Then change the filter to get the next subset and export... in a loop.

sathishkumar_go
Partner - Specialist
Partner - Specialist

I have applied the filters after that also its data is big. And also i don't want every time to filter. it should be automatic.

so i need to find out the no of rows in the object. based on the rows it should be export into different slieds.

do you hav eany macro for the object spliting?

Sathish