4 Replies Latest reply: Jan 15, 2016 4:04 AM by Peter Cammaert RSS

    How to create Word document report using Qlikview

    Sandeep Sharma

      Hi,

       

      I am using Qlikview 11 and want to create a Word document report for QlikView Charts objects using Marcos.

      I have Office 2016 installed my machine.

      Below is my sample Macro but it failed to create "Word.Application".

       

      sub Export_to_Microsoft_Word   

      On Error Resume Next

      set objWord = CreateObject("Word.Application")

      msgbox(objWord)

      objWord.visible = false

      set objDoc=objWord.Documents.add

      Const wdOrientLandscape = 1

      'setting the orientation for MS Word

      objDoc.PageSetup.Orientation = wdOrientLandscape

      'instructing the Macro to copy the Table object(TB01)

      ActiveDocument.GetSheetObject("SH25").CopyTableToClipboard true

      objWord.Selection.Paste

      'Instructing the Macro to save the file in a particular location

      objDoc.SaveAs "C:\QlikViewWordReport"

      'instructing the Macro to copy the Chart object(CHO1)

      ActiveDocument.GetSheetObject("CH334").CopyBitmapToClipboard

      objWord.Selection.Paste

      objDoc.SaveAs "C:\QlikViewWordReport"

      msgbox("Exported")

       

      'handle the error

          If Err.Number <> 0 Then

             'the error handler is now active

             MsgBox "Error #" & CStr(Err.Number) & " " & Err.Description, vbCritical, "Error"

          End If

      end sub

       

      It gives objWord object blank.

       

      Please help....