|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Can we Copy all Comments from a WORD document to another document ?
Hi Guys,
I have tried the Script given by Scripting Guy! (Microsoft Site) to copy comments from an Excel document to another WORD document. But I now wish to do same for WORD documents too. Thats is: I want to copy all comments of Word Document 1 to another document. This document will have only comments from Document 1. To do so I have set following script: Set objWord1 = CreateObject("Word.Application") objWord1.Visible = True Set objDoc1 = objWord1.Documents.Open("D:\work\Document1.doc") objDoc1.Activate Set colComments = objWord1.Comments For Each objComment in colComments strComments = strComments & objComment.Text & vbCrlf & vbCrLf Next objWord1.Quit Set objWord = CreateObject("Word.Application") objWord.Visible = True Set objDoc = objWord.Documents.Add() Set objSelection = objWord.Selection objSelection.TypeText strComments But I am getting following error: E:\Useful Scripts\Copy Comments (Word).vbs (7, 1) Microsoft VBScript runtime error: Object doesn't support this property or method: 'objWord1.Comments' Can any one help me here.. Praveer Verma. |
|
#2
|
|||||
|
|||||
|
The Microsoft Word object doesn't have a Collection property so your colComments collection is empty.
This code is bad: vb Code:
This type of code is often much more trouble than it's worth, but if you're still intent on trying it, take a closer look at the Selection property. There are tons of methods that go along with it too. Here's the Word object reference. And here's some good examples.
__________________
Click the image if at any point you don't like my decision.Scripting problems? Windows questions? Ask the Windows Guru! |
![]() |
| Viewing: ASP Free Forums > System Administration > Windows Scripting > Can we Copy all Comments from a WORD document to another document ? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|