Skip to content

Instantly share code, notes, and snippets.

@ojas
Created October 3, 2014 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ojas/e7dfdd3865bcb17b8f35 to your computer and use it in GitHub Desktop.
Save ojas/e7dfdd3865bcb17b8f35 to your computer and use it in GitHub Desktop.
Office Macros
' via http://www.extendoffice.com/documents/excel/1579-excel-export-comments-to-word.html
Sub CopyCommentsToWord()
'Update 20140325
Dim xComment As Comment
Dim wApp As Object
On Error Resume Next
Set wApp = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Err.Clear
Set wApp = CreateObject("Word.Application")
End If
wApp.Visible = True
wApp.Documents.Add DocumentType:=0
For Each xComment In Application.ActiveSheet.Comments
wApp.Selection.TypeText xComment.Parent.Address & vbTab & xComment.Text
wApp.Selection.TypeParagraph
Next
Set wApp = Nothing
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment