Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I realise how many of those topic was here already. Somehow I cannot get exactly what I need, so I decided to ask.
Can someone please advice?
I need to export some objects from qlikview into ppt. The ppt already exist and specific objects must go to a specific slide.
The problem I have is when the all screen is pasted into PowerPoint the image itself is larger than a content of a screen.
I have everything what was in qlikview plus huge white border around it.
Also not sure how to resize it properly. Can you please advice?
Here is my code:
Sub ExportPPT
Set PPApp = CreateObject("Powerpoint.Application")
PPApp.Visible = True
Set PPPres = PPApp.Presentations.Open("path to ppt")
'Select the slide
Set PPSlide = PPPres.Slides(3)
set s=ActiveDocument.Sheets("SH07")
ActiveDocument.Sheets("SH07").Activate
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetSheetObject("CH02").CopyBitmapToClipboard
With PPSlide.Shapes.Paste
.Left = 20
.top = 100
.width=100
.height=120
end with
Set PPSlide = PPPres.Slides(4)
set s=ActiveDocument.Sheets("SH24_093561284")
ActiveDocument.Sheets("SH24_093561284").Activate
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.ActiveSheet.CopyBitmapToClipboard
With PPSlide.Shapes.Paste
.Left = 20
.top =80
.width=500
.height=500
end with
Set PPSlide = PPPres.Slides(6)
set s=ActiveDocument.Sheets("SH08")
ActiveDocument.Sheets("SH08").Activate
ActiveDocument.GetApplication.WaitForIdle
Activedocument.fields("Country Project").select "Programme"
ActiveDocument.GetSheetObject("CH04").CopyBitmapToClipboard
PPSlide.Shapes.Paste
Activedocument.fields("Country Project").Clear
ActiveDocument.Sheets("SH25_415204754").Activate
'PoaP France
Set PPSlide = PPPres.Slides(12)
set s=ActiveDocument.Sheets("SH07_337920122")
ActiveDocument.Sheets("SH07_337920122").Activate
ActiveDocument.ActiveSheet.FitZoomToWindow
ActiveDocument.ClearAll False
Activedocument.Fields("Country Project").select "France"
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.ActiveSheet.CopyBitmapToClipboard
With PPSlide.Shapes.Paste
.Left = 20
.top =150
.width=400
.height=400
end with
set PPApp = nothing
set PPPRes = nothing
End Sub
I don't see anything in the code that would duplicate the image. Have you accidentally saved the PowerPoint with the large image on the slide?
Well yes - you are right. but then I did remove it, saved ppt again and use the code you suggested and it still will paste huge document...don't understand that really...any idea?
ActiveDocument.ActiveSheet.CopyBitmapToClipboard
PPSlide.Shapes.Paste.Select
PPApp.ActiveWindow.Selection.ShapeRange.PictureFormat.CropRight = PPApp.ActiveWindow.Selection.ShapeRange.Width - 753.89
PPApp.ActiveWindow.Selection.ShapeRange.PictureFormat.CropBottom = PPApp.ActiveWindow.Selection.ShapeRange.Height - 479.5
PPApp.ActiveWindow.Selection.ShapeRange.Top = 120
PPApp.ActiveWindow.Selection.ShapeRange.Left = 5
PPApp.ActiveWindow.Selection.ShapeRange.Width = PPApp.ActiveWindow.Selection.ShapeRange.Width * 0.50
It looks like
PPSlide.Shapes.Paste.Select
is not working, as after executing the script editor is opened with the cursor in that line...
(sorry if that is stupid assumption, I am quite new to this)