R
Ricky Marek
How can I get a list of unique tags collected from a document by running a search operation.
The tags are composed a single word enclosed by '[#' and ']' or '[!' and ']'.
For example [#ABC], [#FOO], [!FOO], [!BAR], [!WXYZ].
The tags may appear more than once in the document, therefore I should ignore the duplicated ones and build a unique list of tags. (The tags collected from the example above would be "ABC", "BAR", "FOO", "WXYZ")
It would be nice to have them sorted as well
The idea is to generate the list and use it to fill a user form combo box, filled dynamically.
Can you give an idea how to run this?
The code I was using is similar to:
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "(\[[!#])(*)(\])"
.Replacement.Text = ""
.Wrap = wdFindContinue
.MatchWildcards = True
End With
But this runs on all the document and removes the tag.. How do I do for collecting the tag without removing?
Thanks in advance.
--- Ricky Marek.
The tags are composed a single word enclosed by '[#' and ']' or '[!' and ']'.
For example [#ABC], [#FOO], [!FOO], [!BAR], [!WXYZ].
The tags may appear more than once in the document, therefore I should ignore the duplicated ones and build a unique list of tags. (The tags collected from the example above would be "ABC", "BAR", "FOO", "WXYZ")
It would be nice to have them sorted as well
The idea is to generate the list and use it to fill a user form combo box, filled dynamically.
Can you give an idea how to run this?
The code I was using is similar to:
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "(\[[!#])(*)(\])"
.Replacement.Text = ""
.Wrap = wdFindContinue
.MatchWildcards = True
End With
But this runs on all the document and removes the tag.. How do I do for collecting the tag without removing?
Thanks in advance.
--- Ricky Marek.