Private SubCommandButton1_Click ()'Dim Cmt as Comment DimExcelapp as Object DimXLSWBK, Objwdapp as Object DimCommentsarrayDimRows, temp, I, X, y as Integer DimFileName as String 'Dim Mywdoc as Word.Document DimAuthorName as String 'get the name of the file in the selectionfilename =Application.getopenfilenameIffilename ="False" Then Exit Sub End If SetObjwdapp =CreateObject("Word.Application") objwdapp.visible=False 'implicitly Open SetMywdoc =objWdApp.Documents.Open (filename) Temp=0x= Ay= Arows=Mywdoc.Comments.CountReDimCommentsarray (1 toRows1 to 4) Ifrows =0 Then MsgBox "no annotations!" End If withWorksheets (1) Do while. Cells (x,1) <>""x= x +1 Loop IfX > A Theny=x x= . Cells (X-1,1) Elsex=0 End If End with fori =1 toRows Temp= temp +1
x = x +1
'Serial NumberCommentsarray (temp,1) = X
'content referenced by annotationsCommentsarray (temp,2) =mywdoc.comments (i). Scope'Annotation ContentCommentsarray (temp,3) =mywdoc.comments (i). Range'Page/LineCommentsarray (temp,4) ="in section"& Mywdoc.comments (i). Scope.information (3) &"Page No."& Mywdoc.comments (i). Scope.information (Ten) &"Line" 'authorAuthorName =mywdoc.comments (i). Author Next
Worksheets (1). Cells (2,2) =Mywdoc. Name Worksheets (1). Cells (3,2) =AuthorName'Mywdoc. BuiltInDocumentProperties (14) Get total pages withWorksheets (1) . Range ("A"& y). Resize (Rows,4) =Commentsarray. Columns.AutoFitEnd withMywdoc. Application.QuitEnd SubPrivate SubCommandButton2_Click () Worksheets (1). Range ("A12"). Resize ( $,4) =""Worksheets (1). Cells (2,2) =""Worksheets (1). Cells (3,2) ="" End Sub
Interface
Word View comments Export (VBA)