A family of Microsoft word processing software products for creating web, email, and print documents.
My original macro still works, but perhaps could do with changing to late binding thus:
Sub CopyCommentsToExcel()
'Create in Word vba
Dim xlApp As Object
Dim xlWB As Object
Dim i As Integer
On Error Resume Next
Set xlApp = GetObject(, "Excel.Application")
If Err Then
Set xlApp = CreateObject("Excel.Application")
End If
On Error GoTo 0
xlApp.Visible = True
Set xlWB = xlApp.Workbooks.Add ' create a new workbook
With xlWB.Worksheets(1)
For i = 1 To ActiveDocument.Comments.Count
.Cells(i, 1).Formula = ActiveDocument.Comments(i).Initial
.Cells(i, 2).Formula = ActiveDocument.Comments(i).Range
.Cells(i, 3).Formula = Format(ActiveDocument.Comments(i).Date, "dd/MM/yyyy")
Next i
End With
Set xlWB = Nothing
Set xlApp = Nothing
End Sub
The error relates to aldoDuke's addition of Function ParentLevel(Para As Word.Paragraph) As String which I have not evaluated.
The first macro (no section references) works. I would like to use the macro with section references. still getting the error: Run-time error '91': Object variable or with block variable not set.
It's a very helpful macro and thanks for all your help!
Kaye