Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
marcus_sommer

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

Anonymous
Not applicable
Author

Siva_Sankar
Master II
Master II

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

Peter_Cammaert
Partner - Champion III
Partner - Champion III

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.