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

CopyBitmapToClipboard

Hi!

I have a problem when I try to copy an object into a Word (as Image) mutiple times.

This is a sample of the script that I've done:

Sub Report


Set XWord = CreateObject("Word.Application")
XWord.Visible=true

Set DocWord = XWord.Documents.add()

Set F= ActiveDocument.Fields("User")
Set FieldValue= F.GetSelectedValues(F.GetValueCount(1))

For k=0 to F.Count-1


ActiveDocument.Fields("User").Select FieldValue.Item(k).Text

XWord.Selection.InsertBefore "Titulo"&chr(13)
XWord.Selection.Collapse wdCollapseEnd

ActiveDocument.ClearCache
ActiveDocument.GetApplication.WaitForIdle

set image = ActiveDocument.GetSheetObject("CH684")
image.CopyBitmapToClipboard
XWord.Selection.Paste

next

end sub

The Script stops when it reaches "image.CopyBitmapToClipboard".Does somebody know if there is a issue with this function?

Version: 9.00.7320.7 SR2 64-bit Edition

Thanks!

5 Replies
brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi, Sylverine,

try the command ExportBitmapToFile, look for further information in the APIGuide.QVW, situated in you QlikView program folder and Documentation

Anonymous
Not applicable
Author

Hi Martina,

Thanks, but I need the charts in a .Doc and not in a File, because what I'm doing is a report and I Mix them with other objects and Text.

Regards,

Syl

erichshiino
Partner - Master
Partner - Master

Hi, I tried your code and I got an error even before you got it.

I created a sample app with two different macros based in your code.

With a little adjustment in it I was able to export, but only when there was a selection in the field.

I created a second macro where you can export all posible values (user can make selection on otherf fields, and we don't export anything if it is not related).

Please, don't mind the charts, they don't make any sense. I was just using this to study the macro.

Hope it works for you.

Not applicable
Author

QV 9 is really different from QV 8, your code will function well in QV 8.

Please add a line code as following:

ActiveDocument.GetApplication.WaitForIdle

set image = ActiveDocument.GetSheetObject("CH02")
image.CopyBitmapToClipboard
XWord.Selection.Paste

I met this issue before and got offical reply as above.

May it will help you.

Anonymous
Not applicable
Author

Has anyone come up with a solution for this in QlikView 11.2? I have tried ActiveDocument.ClearCache, ActiveDocument.GetApplication.WaitForIdle 50 (and other parameters), but the macro I am working with still stops at CopyBitmapToClipboard when trying to loop through multiple objects and export them to Excel.