ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Exporting comments (https://www.excelbanter.com/excel-programming/391220-re-exporting-comments.html)

Barb Reinhardt

Exporting comments
 
This will copy it to a WORD application.

Sub CopyCommentsToWord()

Dim cmt As Comment
Dim WdApp As Object
Dim aWS As Worksheet

On Error Resume Next
Set WdApp = GetObject(, "Word.Application")
If Err.Number < 0 Then
Err.Clear
Set WdApp = CreateObject("Word.Application")
End If
Debug.Print "after err.number"

With WdApp
.Visible = True
.Documents.Add DocumentType:=0
For Each aWS In ActiveWorkbook.Worksheets
For Each cmt In aWS.Comments
.Selection.TypeText cmt.Parent.Address _
& vbTab & cmt.text
.Selection.TypeParagraph
Next
End With
Next aWS

Set WdApp = Nothing

End Sub

"Mark" wrote:

Can someone supply me with some code which examines a workbook, finds
comments in cells and then copies the contents of those comments into a
seperate workbook as the code runs through each worksheet in a workbook.

Mark



All times are GMT +1. The time now is 05:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com