Export Comments with referred text and line numbers from Word to Excel

Masarah

New Member
Joined
Jan 11, 2020
Messages
1
Office Version
  1. 2019
Platform
  1. MacOS
Hello,

Unfortunately, I have no idea about Macros and VBA and everything I find in the internet is half information so I hope someone can tell me step by step what to do:

For my master thesis, I commented on interviews in Word.
To analyse further, I need to export the comments with the referred text and the line number (from word doc) to an excel spread sheet - so 3 columns (line - comment - referred text) with one line per comment.

1) How do I start the process in word? I have word 2019. Under "View", there is a "Macros" option, but it only says "record" and "view", but I can not record
2) Which code do I have to type in (as far as I understood from my internet research, i need to enter a code)
3) Is there something more I have to do or does the excel open and create itself?

Thank you yo much for your help!

Best
S.
 
Thank you so much for this great VBA code ! it work like a charm for me !!!
I have a FU question though, do you know if there is a code to add to have a column showing if comment is marked as "resolved" or not ? This way I can also filter this on the excel export.

Thank you !!
 
Upvote 0

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Surely it's a simple matter to add a suitable column heading to the workbook after the macro has finished exporting the data??? Besides which, from where would the macro get the 'resolved' data?
 
Upvote 0
Surely it's a simple matter to add a suitable column heading to the workbook after the macro has finished exporting the data??? Besides which, from where would the macro get the 'resolved' data?
Thanks for your reply Paul ! :)
I have more than 600 comments in my file so adding this column manually after is a lot of work 😰
I'm a total newbie in VBA so I was asking a naive question, and was simply asking if such a code was possible to add in the VBA code the same ways as the page number, the date, etc.
 
Upvote 0
Manually adding an extra column heading in Excel afterwards takes perhaps 5 seconds...

And you still haven't answered the second question.
 
Upvote 0
This would be a total lifesaver for me if it worked. However, when I run it I get "Compile Error: Invalid Outside Procedure". Im not knowledgeable on this sort of thing so if someone can tell me how to fix this it would be a Godsend. Thank-you
 
Upvote 0
Since the code works as posted, once can only assume there is a problem with how you've tried to implement it. I suspect you've omitted the first line:
Sub ExportComments().

All you need to do is to copy and paste the entire code and paste it into any code module in the document you want to run it from.
 
Upvote 0
Hi there,
Im not sure how you can make it work on Excel but you can use this link that will do the same thing but on Microsoft Word. I just tried it- it added line#, page #, author, where comment is coming from, comment, author and time comments was made.

Hope this is helpful!

Apologies my fault entirely. I didnt notice the scroll bar so the whole thing was not copied and pased
 
Upvote 0
Hi all,
for some reason, the reference text column remains empty when running the code (all other columns include the right data)- any suggestions?
Many thanks!
Coding error - replace .Reference.Text with .Scope.Text
 
Upvote 0
You could, for example, add:
Code:
StrCmt = StrCmt & vbTab & .Scope.GoTo(What:=wdGoToBookmark, Name:="\HeadingLevel").Paragraphs.First.Range.ListFormat.ListString
StrCmt = StrCmt & vbTab & .Scope.GoTo(What:=wdGoToBookmark, Name:="\HeadingLevel").Paragraphs.First.Range.Text
What modifications do i need to do to be able to extract the Headling Level 2
 
Upvote 0
You have two options:
1. implement a loop that keeps looking for a previous heading at the heading 2 level; or
2. Use Find to locate a previous heading at the heading 2 level.
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top