Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
Try putting double quotes like:
set objWord = CreateObject("Word.Application")
and
ActiveDocument.GetSheetObject("TB06").CopyTableToClipboard true
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.
Try putting double quotes like:
set objWord = CreateObject("Word.Application")
and
ActiveDocument.GetSheetObject("TB06").CopyTableToClipboard true
Hi,
Did you set
Requested Module Security->System Access
and
Current Local Security->Allow System Access.
Regards,
Thanks. It's working.
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