Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wildcard search Forgone Excel Worksheet Functions 5 February 18th 09 03:50 AM
help with a wildcard search Billy Craig Excel Discussion (Misc queries) 1 July 1st 08 04:12 PM
Import cells from excel into word and create multiple word docs scdaddy7269 Excel Programming 2 March 20th 06 07:03 PM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven Excel Discussion (Misc queries) 1 January 24th 06 03:28 PM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven[_2_] Excel Programming 1 January 24th 06 04:23 AM


All times are GMT +1. The time now is 06:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"