Finding the next character or table cell (or anything!) after a given point?

R

Robin Tucker

Hi,


I would like to find the range of the first "item" (anything) after another
item (in this instance, a field code). Basically, I want to ignore
whitespace, carriage returns, page breaks etc. At present, I find the next
character after my field code like this:

theRange = MyDocument.Fields.Item(0).Result
theRange.End = theRange.End + 1
theRange.Collapse wdEnd

But the part of the document I'm interested in may be several carriage
returns or whitespaces or page breaks away. I notice that the units
enumeration in Word has "wdItem". However, when moving range with
theRange.Move, wdItem causes an error. So if my field code looks like this:

<<SECTION_START>>

------------------
- Here is a table -
------------------
<<SECTION_END>>

How should I go about setting the range to cover just the table? (assume
that there could be multiple carriage returns and/or spaces between
SECTION_START and the table.


Any tips would be greatly appreciated,




Robin
 
W

Word Heretic

G'day "Robin Tucker" <[email protected]>,

TheRange.Tables(1).Range



Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


Robin Tucker reckoned:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top