5 Replies Latest reply: Mar 23, 2016 3:03 PM by John Watson RSS

    CopyBitmapToClipboard

    Albert Tapia

      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!

       

        • AW:CopyBitmapToClipboard
          Martina Brenner

          Hi, Sylverine,

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

          • CopyBitmapToClipboard
            Erich Shiino

            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.

            • CopyBitmapToClipboard

              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.

              • Re: CopyBitmapToClipboard
                John Watson

                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.