[AccessD] Scrape Word

Hale, Jim Jim.Hale at FleetPride.com
Fri Apr 15 17:18:20 CDT 2005


I'll look at it some more on Monday. You might examine the selection object
in the Word application. It has numerous properties and methods one or more
of which should do the trick.
Jim Hale

-----Original Message-----
From: Bob Heygood [mailto:bheygood at abestsystems.com]
Sent: Friday, April 15, 2005 4:52 PM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] Scrape Word


yes in a table cell.
again your code is working super.
but only grabs the first word, sometimes there is more than one word in the
cell, and I would like to capture all of them.
if you have thought, I would welcome it.


again I tried to manipulate the code further but it acts very erratic when
in a table cell.

thanks for the great help.

bob


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Hale, Jim
Sent: Thursday, April 14, 2005 12:53 PM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] Scrape Word


So the data you want (including the search string) is in a table cell? In
the code I sent you delete
   wd.Selection.Start = wd.Selection.End
   Call wd.Selection.EndOf(wdSentence, wdExtend)

and replace with
   wd.Selection.Next(Unit:=wdWord, Count:=1).Select

Or if the entire string is returned you can replace the search string with
an empty string "" using the following function:

Function ReplaceString(strTextIn As String, strFind As String, strReplace As
String, fCaseSensitive As Boolean) As String

  Dim strTmp As String
  Dim intPos As Integer
  Dim intCaseSensitive As Integer

  intCaseSensitive = IIf(fCaseSensitive, 2, 1)

  strTmp = strTextIn
  intPos = InStr(1, strTmp, strFind, intCaseSensitive)

  Do While intPos > 0
    strTmp = Left$(strTmp, intPos - 1) & strReplace & Mid$(strTmp, intPos +
Len(strFind))
    intPos = InStr(intPos + Len(strReplace), strTmp, strFind,
intCaseSensitive)
  Loop

  ReplaceString = strTmp

End Function

Jim Hale


***********************************************************************
The information transmitted is intended solely for the individual or
entity to which it is addressed and may contain confidential and/or
privileged material. Any review, retransmission, dissemination or
other use of or taking action in reliance upon this information by
persons or entities other than the intended recipient is prohibited.
If you have received this email in error please contact the sender and
delete the material from any computer. As a recipient of this email,
you are responsible for screening its contents and the contents of any
attachments for the presence of viruses. No liability is accepted for
any damages caused by any virus transmitted by this email.


More information about the AccessD mailing list