Hale, Jim
Jim.Hale at FleetPride.com
Mon Apr 11 14:42:30 CDT 2005
Here is some quick and dirty code that opens a Word doc from inside Access, searches for the string "special code:" and sets a string variable equal to the sentence that follows the code string. If your documents all have the same string you can find that string and select words, sentences or paragraphs that come after it. HTH Jim Hale Function LiftText() Dim wd As Word.Application, strPhrase As String, strFindphrase As String strFindphrase = "special code:" Set wd = New Word.Application wd.Documents.Open "C:\Test.doc" wd.Visible = True wd.Selection.Find.ClearFormatting With wd.Selection.Find .Text = strFindphrase .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With wd.Selection.Find.Execute wd.Selection.Start = wd.Selection.End Call wd.Selection.EndOf(wdSentence, wdExtend) strPhrase = wd.Selection MsgBox "Look what I found: " & strPhrase wd.ActiveDocument.Close wd.Quit Set wd = Nothing End Function -----Original Message----- From: Bob Heygood [mailto:bheygood at abestsystems.com] Sent: Monday, April 11, 2005 12:52 PM To: Access Developers discussion and problem solving Subject: RE: [AccessD] Scrape Word sounds good but their tech guy says does not work with Word. thanks anyway. -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Hale, Jim Sent: Monday, April 11, 2005 6:30 AM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] Scrape Word Monarch is a good solution. It has an object model that can be programmed from Access. I use it to extract data from text files directly into Access. Jim Hale -----Original Message----- From: Bob Heygood [mailto:bheygood at abestsystems.com] Sent: Saturday, April 09, 2005 3:07 PM To: Access Developers discussion and problem solving Subject: [AccessD] Scrape Word Hello to the list, I am looking to programmically extract data from about 250 Word docs. It appears that there are no bookmarks, fields or table structure. It also looks like all data are in the same place and associated with the same phrase ahead of the data of interest. So, if I "find" the proper phrase and capture the text after it, I think that will do. Issues like how to know when to stop and such will be interesting. thots? best, bob accesspro at nospamcox.net -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com *********************************************************************** 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. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com *********************************************************************** 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.