Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

macro for copying image to clipboard

I have this Macro for Copying Image to Clipboard
Sub eppt

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

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

For each item in myArray

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

Next

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

End Sub
But the problem is that in my QVW file only two of these charts arecan be active at a time. So this macro does not work in that case. So what can be the modification in the macro so that it identifies the active chart out of these four and copies them ??
6 Replies
Alexander_Thor
Employee
Employee

Have not tested this and coding from memory but should work:

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


Next

You might also want to look into the pastespecial method for powerpoint instead if you get a degrade in image quality.

m_woolf
Master II
Master II

Try this:

If ActiveDocument.GetSheetObject(item).IsActive then

     ActiveDocument.GetSheetObject(item).CopyBitmapToClipboard

End If

Not applicable
Author

Both of the logics above are not working

Not applicable
Author

I am writing this, its not working.
Sub CopyToClipboard

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

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
Anonymous
Not applicable
Author

Hi

     You can see this link thread , hope this will give you some idea about copying image to ppt.

http://community.qlik.com/message/194216#194216

Regards

Ashok

Anonymous
Not applicable
Author

Hi

     You just make the in active table/widget into active before you exporting.

     I believe you are using the toggle button to active or inactive some exporting widgets.

     Then before you export the widget you just change that inactive widget to active using the toggle button variable

value.

     First set the inactive toggle button variable to show active and export the widget then de active the widget.

below code macro use  to get the variable value and set the variable

Set objChart = ActiveDocument.Variables("togglevariablename")

    objChart.SetContent variablevalue, true ---> set value of toggle button to active the field

    

once the export image completed the reset the variable.

Regards

Ashok