Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

tosandeep10
New Contributor II

How to create Word document report using Qlikview

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....

4 Replies
MVP & Luminary
MVP & Luminary

Re: How to create Word document report using Qlikview

You need to ensure that word is installed on the machine, that the modul has system rights (modul editor - left side within the mid). Further something like msgbox(objWord) didn't worked (well) - how should a msgbox display an object, I haven't tried it - maybe it returned true or false to show the existence.

What worked is here: Re: Macro to paste Text Object in Word

- Marcus

balrajahlawat
Esteemed Contributor

Re: How to create Word document report using Qlikview

Siva_Sankar
Honored Contributor

Re: How to create Word document report using Qlikview

Sandeep,

Check out my doc here EXPORTING QLIKVIEW OBJECTS TO MICROSOFT WORD TO PREDETERMINED LOCATION.docx

It may help.

Make sure you are testing the macro in the machine where qlikview is installed have MS word. Incase the qlikview you are running is in server which don't have MS word installed and it wont launch the Word doc from desktop.

Regards,

Siva Sankar

Re: How to create Word document report using Qlikview

There is a pretty powerful solution for your problem. It allows you to create any kind of Word document (based on a Word template) using any object from multiple QVW documents that are located on your PC or on a QlikView server. It's called NPrinting and is delivered these days by Qlik. Documentation can be found on the Qlik Products page by opening the QlikView menu.