Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
sachingodhania
New Contributor II

Export straight/PIVOT to PPT problem

Hi All ,

I am facing some prob in pasting straight/pivot to ppt to a specific slideno, I  am using code as below ,

sub ppt

set objPPT = CreateObject("PowerPoint.Application")

objPPT.Visible = True

Set objPresentation = objPPT.Presentations.Add

ActiveDocument.Sheets("SH01").Activate

Set obj = ActiveDocument.GetSheetObject("CH03")

Set PPSlide = objPresentation.Slides.Add(1,obj.GetObjectType) 

obj.CopyTableToClipboard true

With PPSlide

objPPT.CommandBars.ExecuteMso ("PasteSourceFormatting")

End With

Set obj = ActiveDocument.GetSheetObject("CH04")

Set PPSlide = objPresentation.Slides.Add(2,obj.GetObjectType) 

obj.CopyTableToClipboard true

With PPSlide

objPPT.CommandBars.ExecuteMso ("PasteSourceFormatting")

End With

  End Sub

By this code table always copies on first slide of the PPT and doesn't respect the .left and top Position.

Please let me know if any body had encountered the same issue. Thanks !

Regards,

Sachin

1 Solution

Accepted Solutions
jerem1234
Valued Contributor II

Re: Export straight/PIVOT to PPT problem

Hi Sachin!

You should try this code:

sub ppt

set objPPT = CreateObject("PowerPoint.Application")

objPPT.Visible = True

Set objPresentation = objPPT.Presentations.Add

For j=1 To 2

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

next

ActiveDocument.Sheets("SH01").Activate

Set obj = ActiveDocument.GetSheetObject("CH03")

objPresentation.Slides(1).Select

obj.CopyTableToClipboard true

objPPT.CommandBars.ExecuteMso ("PasteSourceFormatting")

Set obj = ActiveDocument.GetSheetObject("CH04")

objPresentation.Slides(2).Select

obj.CopyTableToClipboard true

objPPT.CommandBars.ExecuteMso ("PasteSourceFormatting")

End sub

I found out you don't need the With PPSlide to do Paste Source Formatting since it will paste it in you active slide. So you want to choose the slide you want to paste it on with the statement:

objPresentation.Slides(1).Select


Hope this helps!!

6 Replies
Chanty4u
Esteemed Contributor III

Re: Export straight/PIVOT to PPT problem

sachingodhania
New Contributor II

Re: Export straight/PIVOT to PPT problem

Hi Suri,

I have gone through this link. The issue is I am using copytabletoclipboard and its pasting on slide1 only.

Regards,

Sachin

hirishv7
Honored Contributor

Re: Export straight/PIVOT to PPT problem

Hi,

Check with this code,

Are you exporting two objects or what's the issue can you elaborate!!

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 

HTH,

Hirish

sachingodhania
New Contributor II

Re: Export straight/PIVOT to PPT problem

HI Hirish,

Thanks for code.

I need to user obj.CopyTableToClipboard instead of CopyBitmapToClipboard    in order to copy table.

Regards,

Sachin

jerem1234
Valued Contributor II

Re: Export straight/PIVOT to PPT problem

Hi Sachin!

You should try this code:

sub ppt

set objPPT = CreateObject("PowerPoint.Application")

objPPT.Visible = True

Set objPresentation = objPPT.Presentations.Add

For j=1 To 2

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

next

ActiveDocument.Sheets("SH01").Activate

Set obj = ActiveDocument.GetSheetObject("CH03")

objPresentation.Slides(1).Select

obj.CopyTableToClipboard true

objPPT.CommandBars.ExecuteMso ("PasteSourceFormatting")

Set obj = ActiveDocument.GetSheetObject("CH04")

objPresentation.Slides(2).Select

obj.CopyTableToClipboard true

objPPT.CommandBars.ExecuteMso ("PasteSourceFormatting")

End sub

I found out you don't need the With PPSlide to do Paste Source Formatting since it will paste it in you active slide. So you want to choose the slide you want to paste it on with the statement:

objPresentation.Slides(1).Select


Hope this helps!!

sachingodhania
New Contributor II

Re: Export straight/PIVOT to PPT problem

Hi Jeremiah ,

That code pastes exactly on the slide that i want to . Thanks a lot !

On more thing if you can help is I want to make column of table with to content and set font size to 8.

Also the position is working fine in image but for table is not pasting at given co-ordinates.

Regards,

Sachin

Community Browser