A
Al
I am an Access VBA programmer and don't really understand Word VBA programming.
Basically I have MS Word files that I would like to loop through searching
for particular word strings like "Private Sub", trap that entire line, then
count the number of lines until an "End Sub" word string is encountered, then
populate a table or something with the trapped line concatenating the count.
Then search the next and so on through the entire document. Every "Private
Sub" has a corresponding "End Sub".
In sudocode it would look like this;
Loop until EOF
if rtrim(right(line,11)) = "Private Sub" then
Sub(0) = line
SubCount = 1
else if rtrim(right(line,7)) = "End Sub" then
SubCount = SubCount + 1
Call PrintLine (this routine prints Sub(0) & SubCount to a table)
else
SubCount = SubCount + 1
End If
Next
These are not actual word documents as you probably have guessed, but this
is a needed function.
Thanks for your replies!!
Basically I have MS Word files that I would like to loop through searching
for particular word strings like "Private Sub", trap that entire line, then
count the number of lines until an "End Sub" word string is encountered, then
populate a table or something with the trapped line concatenating the count.
Then search the next and so on through the entire document. Every "Private
Sub" has a corresponding "End Sub".
In sudocode it would look like this;
Loop until EOF
if rtrim(right(line,11)) = "Private Sub" then
Sub(0) = line
SubCount = 1
else if rtrim(right(line,7)) = "End Sub" then
SubCount = SubCount + 1
Call PrintLine (this routine prints Sub(0) & SubCount to a table)
else
SubCount = SubCount + 1
End If
Next
These are not actual word documents as you probably have guessed, but this
is a needed function.
Thanks for your replies!!