Monday, January 30, 2012

How to Extract Comment information from Word VBA

How to Extract Comments Text and Related Information from Word Document using VBA

Here is a hint of accessing the comments and related information using VBA

Sub Get_Comment_Information()

Dim oComment As Comment
Dim oCommentRange As Range

For i1 = 1 To ActiveDocument.Comments.Count
    Set oComment = ActiveDocument.Comments(i1)
    Set oCommentRange = oComment.Scope.Paragraphs(1).Range
    Debug.Print "Page : " & oCommentRange.Information(wdActiveEndPageNumber) & vbTab _
                     & "Line : " & oCommentRange.Information(wdFirstCharacterLineNumber) & vbTab

    

Next i1

End Sub

3 comments:

  1. Anonymous4:29 PM

    Hello,
    I *really* need to be able to harvest comments from a number of Word documents and put them into an Access database. Unfortunately, I am not a VBA programmer. Any further code or clues you can offer would be most gratefully appreciated.

    Thank you,
    Cynthia

    ReplyDelete
  2. Anonymous11:52 PM

    Cynthia .. You need to loop throught the folder containing the documents - Dir function should be helpful for that. Open each document using Documents.Open and then run the above code snippet

    ReplyDelete
  3. Anonymous8:11 AM

    Hi , Can Any body tell me - how to extract Word Document Comments into Excel - Word Comments into Excel using Excel VBA Macros

    ReplyDelete

StumbleUpon
Share on Facebook
Related Posts Plugin for WordPress, Blogger...

Visual Basic for Applications (VBA) Forum (recent threads)

CodeKeep VBA Feed

Visual Studio Tools for Office Forum (recent threads)

Download Windows Live Toolbar and personalize your Web experience! Add custom buttons to get the information you care about most.

Office Business Applications (OBA) Team Blog

MSDN Code Gallery Published Resources For Tag VSTO

microsoft.public.vsnet.vstools.office Google Group