Hello everyone,
I've been trying to adapt to my needs the acronymlister macros I could find but I am stuck.
I have Word tables containing acronyms of 3 uppercase letters or more. I would like to run the macro on selected tables to find the acronyms within it and to list them right after each table. The list of acronyms should be formatted as
, use semi-colon as separator and, if at all possible, applied the Word style
.
Please find below the code I have been working on. I annotated where I think the code should be changed. Other options are welcome
Code:
Sub ACRO_table
Dim oTbl as Table
Dim oCel as Cell
Dim oRange as Range
For Each oTbl in Selection.Range.Tables
For Each oCel In oTbl.Range.Cells
With oCel.RangeWith .find
.text = "<[A-Z]{3,}>"
.forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = True
.MatchWildCards = True
Do While .Execute
' the following lines of code are wrong i.e. it copies the found acronyms in new cells with new cells
oTbl.Range.collapse wdCollapseEnd
oTbl.Range.Copy
oCel.Range.PasteAndFormat (wdTableOriginalFormatting)
Loop
End with
End with
Next oCel
Next oTbl
Many thanks in advance.
Winrow