Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Import WILDCARD search to EXCEL from WORD
I've browsed the groups and managed to get the code below working to a point.
I'm using OFFICE 2002 and trying to search club minutes done in WORD looking for motions that were made at meetings. Once found the paragraph before the search text and the searched text is imported in two separate strings to EXCEL where the macro resides. The string always starts with "(M" and ends with ")" and also ends a paragraph. I've tried Regular expressions and using wildcards to no avail. Would sure like some help directly with code or a pointer to a reference on how to do this. ~~~ CODE SNIPET ~~~ Sub MotionFinder() Dim sPth As String Dim sNam As String Dim oWrd As Object sPth = "c:\motion\" col = 1 Row = 2 s_counter = 42 Set oWrd = CreateObject("Word.Application") ' Set oWrd = GetObject(, "Word.Application") oWrd.Visible = True sNam = Dir(sPth & "*.doc") While sNam < "" 'Range("C1").Value = s_counter oWrd.documents.Open sPth & sNam 'Open Minute documents 1 at a time Dim rDcm As Object Set rDcm = oWrd.activedocument.Range ' Search all With rDcm.Find .Text = "(M" ' Find a motion NEED WILDCARD TO FIND ALL While .Execute ' Select the motion rDcm.Select Range("A" & Row).Value = rDcm Row = Row + 1 s_counter = s_counter + 1 Wend End With oWrd.activedocument.Close sNam = Dir Wend oWrd.Quit Set oWrd = Nothing End Sub -- Thanks! Ray Tweedale All-around-nice-guy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Wildcard search | Excel Worksheet Functions | |||
help with a wildcard search | Excel Discussion (Misc queries) | |||
Import cells from excel into word and create multiple word docs | Excel Programming | |||
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? | Excel Discussion (Misc queries) | |||
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? | Excel Programming |