Hi,
A set of documents has normal text interspersed with line paragraphs commencing with a date, tab, number, tab, number. I want to retrieve these latter lines, and copy them to an array if the date is later than a pre-set date.
So far, I have done the piece of code given below, which works except that:
- First, I would prefer that the code first searches for a date instead of any number.
- Secondly, I want to copy these lines to a dynamic array, and this does not seem to work.
' Zoek een prestatie lijn vanaf het begin van het bestand
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^#^t^#^t^#^#^t^#^#^t^#"
.Forward = True
.Execute
' Adapt the dynamic array strPrestaties index and fill the
' array as long as the string prestaties is found.
While .Found
.Parent.Expand Unit:=wdParagraph
strPrestatie = Selection.Text
strPrestaties(x) = strPrestatie
x = x + 1
Selection.EndKey Unit:=wdLine
Selection.TypeParagraph
.Execute
Wend
Documents(strBestand).Close SaveChanges:=wdDoNotSaveChanges
A set of documents has normal text interspersed with line paragraphs commencing with a date, tab, number, tab, number. I want to retrieve these latter lines, and copy them to an array if the date is later than a pre-set date.
So far, I have done the piece of code given below, which works except that:
- First, I would prefer that the code first searches for a date instead of any number.
- Secondly, I want to copy these lines to a dynamic array, and this does not seem to work.
' Zoek een prestatie lijn vanaf het begin van het bestand
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^#^t^#^t^#^#^t^#^#^t^#"
.Forward = True
.Execute
' Adapt the dynamic array strPrestaties index and fill the
' array as long as the string prestaties is found.
While .Found
.Parent.Expand Unit:=wdParagraph
strPrestatie = Selection.Text
strPrestaties(x) = strPrestatie
x = x + 1
Selection.EndKey Unit:=wdLine
Selection.TypeParagraph
.Execute
Wend
Documents(strBestand).Close SaveChanges:=wdDoNotSaveChanges