Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I'm hoping someone has experience pasting tables into Powerpoint using paste special. I've had success using CopyToBitmapToClipboard using the following code:
ActiveDocument.GetSheetObject("CH418").CopyBitmapToClipboard
PPSlide.Shapes.Paste.Select
I would like to paste in an editable table instead of an image and I thought something like this code would work:
ActiveDocument.GetSheetObject("CH418").CopyTableToClipboard True
PPSlide.Shapes.PasteSpecial(PasteHTML).Select
However, I get the following error:
Shapes.PasteSpecial : Invalid request. Clipboard is empty or contains data which may not be pasted here.
I confirmed that the Clipboard was not empty by manually pasting from it into Powerpoint. I also tried PasteDefault instead of PasteHTML.
The PasteSpecial works with CopyBitmapToClipboard. The example below worked so I think some form of PasteSpecial should work for straight tables:
ActiveDocument.GetSheetObject("CH418").CopyBitmapToClipboard
PPSlide.Shapes.PasteSpecial(PasteEnhancedMetafile).Select
If anyone has any insights, it would be greatly appreciated. I am using version 10.
thanx
Grant
Yes sachin,
it goes always to the second slide because the instruction marks the second slide.
You just have to adjust the instruction to point to the desired diapo. As example:
Set PPSlide = objPresentation.Slides(2) '-->To point to the second slide
Set PPSlide = objPresentation.Slides(4) '-->To point to the forth slide
HTH
Regards
Hi Alex,
Sorry for typo, i mean to say the table always copies to slide 1 irrespective to the parameter you provide in obj.slides(eg 2).
The logic absolutely works fine with "CopyBitmapToClipboard" but not CopyTableToClipboard
Regards,
Sachin
Hi,
While exporting the qlikview object into PPT, You have to maximize the qlikview object.
I don't know, you already did the same or not.. just to inform you to check these option.
-Sathish
Hi Sathish,
From my experience, there's no need to maximize the object, at least if it's not minimized in the app. If minimized, I haven't tested it. Did you notice any problem while not minimized?
Regards
Hi Alex,
I have faced the issue for the minimized objects (But long time back). For minimized objects, we have to do maximize and export into ppt.
If its not minimized then same time you are keeping the multiple qlikview objects?
-Sathish
Thanks Sathish,
I've just tested,
indeed there's an issue while exporting a minimized object by using the bitmap option [.CopyBitmapToClipboard()],
however, the export works properly when using the table option [.CopyTableToClipboard(true)] on a minimized object.
Thanks for sharing, I didn't know this weird behaviour!
Hi satish,
Yes i am doing that. Not sure what is the issue.
Regards,
Sachin
Hi Alex,
Were you able to replicate the issue ? or its some thing wrong in my macro only.
Regards,
Sachin
Hi sachin,
try the following code:
SUB ppt
Const ppLayoutText = 2
Set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True
Set objPresentation = objPPT.Presentations.Add
Set PPSlide = objPresentation.Slides.Add(1, ppLayoutText)
ActiveDocument.GetSheetObject("CH03").CopyBitmapToClipboard
PPSlide.Shapes.Paste
Set PPSlide = Nothing
Set PPSlide = objPresentation.Slides.Add(2, ppLayoutText)
ActiveDocument.GetSheetObject("CH04").CopyBitmapToClipboard
PPSlide.Shapes.Paste
Set PPSlide = Nothing
End Sub
This works fine on my test
Regards
Hi againg,
The following code saves the issue with the minimized objects, just in case you need it. If the object is minimized then restore it before Copy & Paste and then minimize it.
SUB ppt
Const ppLayoutText = 2
Dim v
v = 0
Set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True
Set objPresentation = objPPT.Presentations.Add
Set PPSlide = objPresentation.Slides.Add(1, ppLayoutText)
Set TargetObject = Activedocument.GetSheetObject("CH03")
If TargetObject.IsMinimized Then
v = 1
TargetObject.Restore
End If
TargetObject.CopyBitmapToClipboard
PPSlide.Shapes.Paste
Set PPSlide = Nothing
If v = 1 Then
TargetObject.Minimize
v = 0
End If
Set TargetObject = Nothing
Set PPSlide = objPresentation.Slides.Add(2, ppLayoutText)
Set TargetObject = Activedocument.GetSheetObject("CH04")
If TargetObject.IsMinimized Then
v = 1
TargetObject.Restore
End If
TargetObject.CopyBitmapToClipboard
PPSlide.Shapes.Paste
Set PPSlide = Nothing
If v = 1 Then
TargetObject.Minimize
v = 0
End If
Set TargetObject = Nothing
End Sub
Regards