Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Seaching a Word Document from Excel Part ii

I have gottern some great help from Helmut Weber, MVP WordVBA on this subject
but have run into another problem. At the end I will put what I'm trying to
do.
When I try to search the word documents I have found that doing a search
using the following code cause a problem with the varible rDcm due to the
fact that the words I am search for are in a textbox in the word document and
to make manners worst there is a border going around the outside of the
docuemnts (they are certificates).

Sub Test455()

Dim col As Integer, row As Integer, s_counter As Integer

Dim sPth As String
Dim sNam As String
Dim oWrd As Object

col = 1
row = 2
s_counter = 1

sPth = "C:\Test Folder\"

Set oWrd = CreateObject("Word.Application")

oWrd.Visible = True
Sheets("Sheet3").Select
sNam = Dir(sPth & "*.doc")
While sNam < ""
Range("C1").Value = s_counter
oWrd.Documents.Open sPth & sNam
Dim rDcm As Object
Set rDcm = oWrd.ActiveDocument.Range
Debug.Print rDcm
With rDcm.Find
.ClearFormatting
.Text = Range("E3").Value
While .Execute
rDcm.Select
Range("A" & row).Value = sNam
row = row + 1
Wend
End With
s_counter = s_counter + 1
oWrd.ActiveDocument.Close

sNam = Dir
Wend
oWrd.Quit
Set oWrd = Nothing
End Sub

Besdies this same, which Helmut provided I have tried to use the Built-in
Dialog Box functions such as wdDialogEditFind but these seem to have another
problem where I can't get it return a value based on the fact that it found
the word.

What I am trying to do is to create a list of file names of Word Documents
(certificates) that have been issues that have certain words in them. These
words will come from a list on a Excel Spreadsheet. Ideally I would like
tocreate something similar to the Search for words or pharse in Windows
Search menu item. The sample code above will do the search but as I said it
seems to ahve a problem with the fact that there is this border around a
textbox and the only results returned are something that looks like a small
"r"
Sorry for the length of this posting and thanks in advance for any help.
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
How can I convert an Excel document to a Word Document has3801 Setting up and Configuration of Excel 1 June 11th 08 11:16 PM
change excel document into word document mrsb Excel Discussion (Misc queries) 6 August 28th 07 12:58 PM
convert excel document to word document (not a picture) frendabrenda1 Excel Discussion (Misc queries) 2 October 6th 06 03:55 PM
How do I link part of an Word document into an Excell workbook? concerned Excel Discussion (Misc queries) 1 June 1st 06 02:50 PM
Can you transform an excel document into a word document? Tammy Excel Discussion (Misc queries) 1 May 19th 05 03:23 PM


All times are GMT +1. The time now is 10:15 PM.

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

About Us

"It's about Microsoft Excel"