Bevos
asked on
Word 2010 Macro: Parse selected text and export to table?
Hello, I have a rather complex macro that I would like someone to help me create. In many documents I have a listing of references which appear in the following format:
##. Authors. Title. Journal Year; Volume(Issue): Pages-Pages.
For example:
10. Bakheit AM, Thilmann AF, Ward AB et al. A randomized double-blind placebo-controlled, dose-ranging study to compare the efficacy and safety of three doses of botulinum toxin type A (Dysport) with placebo in upper limb spasticity after stroke. Stroke 2000; 31(10):2402-66
I would like to export these into a Word table which I can then export into excel and use as a comma separated list in the following manner:
Author, Title, Journal, Year, Volume, Issue, Pages
The delimiters in the records appear with regularity so this task should be possible but it beyond me (and my record macro knowledge) to accomplish. Can one of the experts here help?
I have attached a file which gives some examples and the desired output style. If possible, in the event one of the records doesn't match this formatting, could that entry be highlighted in the word document?
Any help is immensly appreciated.
Thanks,
Bev
example.docx
##. Authors. Title. Journal Year; Volume(Issue): Pages-Pages.
For example:
10. Bakheit AM, Thilmann AF, Ward AB et al. A randomized double-blind placebo-controlled, dose-ranging study to compare the efficacy and safety of three doses of botulinum toxin type A (Dysport) with placebo in upper limb spasticity after stroke. Stroke 2000; 31(10):2402-66
I would like to export these into a Word table which I can then export into excel and use as a comma separated list in the following manner:
Author, Title, Journal, Year, Volume, Issue, Pages
The delimiters in the records appear with regularity so this task should be possible but it beyond me (and my record macro knowledge) to accomplish. Can one of the experts here help?
I have attached a file which gives some examples and the desired output style. If possible, in the event one of the records doesn't match this formatting, could that entry be highlighted in the word document?
Any help is immensly appreciated.
Thanks,
Bev
example.docx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@Bev
>>...interesting pieces of code...
If you want a better understanding of regular expressions (RegEx or RegExp as common abbreviations), check out these articles:
http:A_1336.html
http:A_2140.html
http:A_4318.html
Hopefully, most of your notes are the proper format and won't wind up highlighted.
>>...interesting pieces of code...
If you want a better understanding of regular expressions (RegEx or RegExp as common abbreviations), check out these articles:
http:A_1336.html
http:A_2140.html
http:A_4318.html
Hopefully, most of your notes are the proper format and won't wind up highlighted.
While preparing an Advanced Regular Expressions presentation, I revisited some of the questions I've answered using Regexp. I noticed that the pattern that I used in the solution can be improved. Try this:
(\d+)\.\s+(.*?)\.\s+(.*?)\.\s+(.*?)\s+(\d{4});\s*(\d*)\((.*?)\):(.*?)\.
ASKER
Bev