Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2006

Tip: Looking for answers? Try searching our database.

pulling text from a word document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
colemandg - 31 Jan 2006 13:13 GMT
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.
Cindy M  -WordMVP- - 31 Jan 2006 16:05 GMT
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.

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.