I have a word document that contains a four-column table. The first
two columns contain a Task ID and a Description of Task. One row of
the table will have something like the following for Task ID and
Description cells.
1.1 Use the 'Export' bat file to export projects. Copy exported
projects to the following folder:
L:\nBalance\Prod\BlackrockToSimcorp\Position\admin
I need to be able to find the cell that has the text: "Use the
'Export' bat file to export projects. Copy exported projects to
the following folder:", and pull out the path/directory structure that
is provided afterwards. There is a little bit of complexity in that
the path will always differ and I can not always assume that the
information is in Task 1.1.
Any thoughts on how to accomplish this?
Thanks in advance.
Hi Colemandg,
> I have a word document that contains a four-column table. The first
> two columns contain a Task ID and a Description of Task. One row of
[quoted text clipped - 13 lines]
>
> Any thoughts on how to accomplish this?
We can assume that the path will always follow the text (plus colon and
space)?
Use the FIND property (as in Selection.Find or Range.Find) to locate the
text. Collapse the selection or range to a point. Extend it to the end
of the cell, minus two characters to pick up the path. Very roughly:
Dim rng as Word.Range
With rng.Find
.Text = "Use the 'Export' bat file to export projects. Copy
exported projects to the following folder:"
.Execute
end With
rng.Collapse wdCollapseEnd
rng.End = rng.Cells(1).Range.End
rng.MoveEnd Unit:=wdCharacter, Count:=2
strpath = rng.Text
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :-)
colemandg - 31 Jan 2006 21:09 GMT
Sweet. I'll try that. Thanks.