Using Macros in MS Word to Export Codes and Notes

By Keith Proctor, Training and Development Manager, CommTech

If you work with qualitative data, you know that managing data sources can be a real challenge. In a recent study, we collected a substantial amount of interview data that was transcribed into Microsoft Word. We then went through the Word documents coding different passages and themes. At the end of the process we needed a way to export the codes, notes, and passages for further analysis. The instructions below reflect how to use a macro to export comments.

  1. In Word, use "Comments" to highlight key passages.

  2. In the comment, include your codes at the top and your notes below the codes.

  3. In Word, access the Macros tool (In 2013 go to View > Macros).

  4. Click “Create” to make a new macro.

  5. This opens a new macro window.

  6. Delete anything in the window and cut and paste the following instead (it should look like the picture below after you paste it):

    Sub exportcomments()
    Dim s As String
    Dim cmt As Word.Comment
    Dim doc As Word.Document
    For Each cmt In ActiveDocument.Comments
    s = s & "Code " & cmt.Index & " and Notes: " & cmt.Range.Text & vbCr & vbCr & "Quote " & cmt.Index & ": " & vbCr & Chr(34) & cmt.Scope & Chr(34) & vbCr & vbCr
    Set doc = Documents.Add
    doc.Range.Text = s
    End Sub

  7. Press the F5 function key or click “Run” at the top of the window. (You do not need to save before running the macro).

  8. This creates and opens a new Word document with your comments, codes, and quotes. Now they can be exported, categorized, and analyzed based on your needs.





To add a comment, Sign In
Total Comments: 7
Mike posted on 11/13/2014 3:22 PM
Thanks for the tip, Keith! The tip is a creative way to leverage Word's functionality to categorize qualitative data.
Carolyn posted on 11/13/2014 4:30 PM
With a few modifications to fit my project, this tip will be very useful!
Lee posted on 11/14/2014 8:09 AM
Thanks Keith! Many of use macros in Excel, but are less familiar with their usage in Word. This tip is a great example of extending the functionality of macros within the Office environment.
Dale posted on 11/14/2014 12:03 PM
Thanks for the tip. Macros are great!
Ishuan posted on 11/14/2014 2:33 PM
Useful tip, thank you!
Shawn posted on 11/18/2014 11:17 AM
Extremely useful tip for helping to summarize qualitative results. Thanks for sharing!
Lisa posted on 11/18/2014 11:37 AM
I appreciate this tip! I haven't used macros much, but I've been wanting to learn more about them. This is timely because I have several qualitative projects on my horizon.