Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro showing error?

Hi,

I have a problem with below macro. The macro will send chart data to msword.

''defining Macro name

sub Export_to_Microsoft_Word

''setting the object as Word and creating the application

set objWord = CreateObject(Word.Application)

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(TB06)

ActiveDocument.GetSheetObject(TB06).CopyTableToClipboard true

objWord.Selection.Paste

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

objDoc.SaveAs "D:\Report"

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

ActiveDocument.GetSheetObject(CH07).CopyBitmapToClipboard

objWord.Selection.Paste

objDoc.SaveAs "D:\Report"

end sub

when I testing this it is showing a message

Object required: 'Word'

How can I set this? please help.

Thanks.

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try putting double quotes like:

set objWord = CreateObject("Word.Application")

and

ActiveDocument.GetSheetObject("TB06").CopyTableToClipboard true

View solution in original post

5 Replies
jerrysvensson
Partner - Specialist II
Partner - Specialist II

Is Word installed on the client machine?

I assume you use Plugin as client, WebView (Ajax) will not work.

Have you set correct security settings in macro, see manual.

tresesco
MVP
MVP

Try putting double quotes like:

set objWord = CreateObject("Word.Application")

and

ActiveDocument.GetSheetObject("TB06").CopyTableToClipboard true

PrashantSangle

Hi,

Did you set

Requested Module Security->System Access

and

Current Local Security->Allow System Access.

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

Thanks. It's working.

Not applicable
Author

Hi Amelia,

I just use the macro related yours but still can't work.

Could you please help me?

''defining Macro name

sub Export_to_Microsoft_Word

''setting the object as Word and creating the application

set objWord = CreateObject("Word.Application")

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(CH01)

ActiveDocument.GetSheetObject("CH01").CopyTableToClipboard true

objWord.Selection.Paste

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

objDoc.SaveAs "\\SVRCN001TPC00.asia.corp.anz.com\tanghe$\My Documents\Export Practise"

end sub