![]() |
|
#1
|
||||
|
||||
![]() How about Code:
Public Function GetVariablesFirstLevel() As Collection Dim objVar As Variable Dim colAux As Collection Dim strAux As String Dim objStoryRange As Range Dim i As Integer Set colAux = New Collection For Each objStoryRange In ActiveDocument.StoryRanges With objStoryRange.Find .ClearFormatting Do While .Execute(findText:="- * -", MatchWildcards:=True) 'strAux = Trim(Replace(objStoryRange.Text, "-", "")) strAux = objStoryRange.Text colAux.Add strAux, UCase$(strAux) objStoryRange.Collapse 0 Loop End With Next objStoryRange 'For i = 1 To colAux.Count 'Debug.Print colAux(i) ' Next i GetVariablesFirstLevel = colAux Set colAux = Nothing Set objStoryRange = Nothing Exit Function End Function
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
![]() |
Tags |
vba, word macro |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Find/replace - symbol for all numbers or symbol letters (Word 97) | Genericname1111 | Word | 10 | 11-10-2019 10:37 PM |
![]() |
Mr. P | Word | 1 | 09-05-2016 11:55 AM |
![]() |
DeniseN | Office | 1 | 03-20-2015 01:13 AM |
![]() |
wondermuse | Word | 5 | 10-09-2014 06:30 AM |
How to enter names in Resource Pool/names | pstein | Project | 1 | 03-26-2012 07:37 AM |