Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry for my previous post not so clear.
Pls. read: and make New Worksheets with Name of each Searching String (illness), so looping thru G2:Gn ? Regards, Gianni. "Big John" ha scritto nel messaggio .. . How modify Sub if searching strings are from range G2 down as follow: G2 head-ache G3 tooth-ache G4 malaria ... and create one Worksheet named with every searching string (illness), so looping thru G2:Gn ? Thanks in advance. Regards, Gianni. "Jacob Skaria" ha scritto nel messaggio ... A minor change...Hardcoded path replaced with variable.. Sub SearchStringinWord() Dim wrdApp As Word.Application Dim wrdDoc As Word.Document Dim strFolder As String Dim strFile As String Dim strSearchString As String Dim lngRow As Long Set wrdApp = CreateObject("Word.Application") wrdApp.Visible = False strFolder = "c:\" strSearchString = "jacob" strFile = Dir(strFolder & "*.doc", vbNormal) Do While strFile < "" Set wrdDoc = wrdApp.Documents.Open(strFolder & strFile) If InStr(1, wrdDoc.Range.Text, strSearchString, vbTextCompare) 0 Then lngRow = lngRow + 1 ActiveSheet.Range("A" & lngRow).Formula = "=HYPERLINK(""" & strFolder & strFile & """,""" & strFile & """)" End If wrdDoc.Close strFile = Dir Loop Set wrdDoc = Nothing wrdApp.Quit Set wrdApp = Nothing End Sub -- If this post helps click Yes --------------- Jacob Skaria |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Saving Word and Excel documents | Excel Discussion (Misc queries) | |||
Printing Word Documents from Excel | Excel Discussion (Misc queries) | |||
Too many word documents, can Excel HELP!!! | Excel Discussion (Misc queries) | |||
Accessing word documents from Excel | Excel Programming | |||
Ever use Excel for documents instead of Word? | Excel Discussion (Misc queries) |