Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Copy To Clipboard

I have written this Macro for copying the active charts out of these 5 to the clipboard. But it is giving me error. Please tell me where i am doing mistake ??
Sub CopyToClipboard

Dim myArray(4)
myArray(0) = "CH05"
myArray(1) = "CH32"
myArray(2) = "CH23"
myArray(3) = "CH15"
myArray(4) = "CH04"

Set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True
Set objPresentation = objPPT.Presentations.Add

For each item in myArray

if ActiveDocument.GetSheetObject(item).IsActive then


Set PPSlide = objPresentation.Slides.Add(1,11)
ActiveDocument.GetSheetObject(item).CopyBitmapToClipboard
PPSlide.Shapes.Paste
end if

Next


Set PPSlide = Nothing
Set PPPres = Nothing
Set PPApp = Nothing

End Sub
2 Replies
jagan
Partner - Champion III
Partner - Champion III

Hi,

What error you are getting?  Is MS PowerPoint installed in your machine, this works only if PowerPoint is installed in the machine.

Hope this helps you.

Regards,

Jagan.

erichshiino
Partner - Master
Partner - Master

Hi,

Sometimes, with this type of operation there is an error when QV moves too fast from one command to the other.

I suggest you include some sleep and waitforidle

please, try this:

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

ActiveDocument.GetSheetObject(item).CopyBitmapToClipboard

ActiveDocument.GetApplication.WaitForIdle

   ActiveDocument.GetApplication.Sleep 5000

  PPSlide.Shapes.Paste

ActiveDocument.GetApplication.WaitForIdle

ActiveDocument.GetApplication.Sleep 5000

If it works, you can try the script with just the waitforidle or reduce the sleep time (milisecond)

Regards,

Erich