General discussion

Locked

Office Visual Basic question

By Chouf ·
I got this question from a user and I have to say I don't have a clue from where I could begin with this. Would you guys have any idea on how I could proceed ?

**Situation:**
--------------
What I have is an excel list with words (filed names of database records) on one side, and on the other side I have a series of word documents (The FRS and ODD specifications of these same products)
What I wanted to do is to complete that excel list with information whether the word appears in the document (adding one column per document and keep a yes/no
list) Doing this manual would be a very time consuming job.

**Idea: **
----------
What I would like to do is write a VB Macro in Excel that is something like:

Loop (for each documentin a directory)
Loop (for each cell in column B)
Cell xy = Searching Word doc for word (column B)
endloop
endloop

So I have two things that I don't know yet and for which I'm looking to you for
help:
1) What function canI use to et all files in a directory
2) Is there a function I can use to search is a word document


That's the mail I got,... any idea ?
i'll give you 200 points for this please...

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Office Visual Basic question

by gregg_gilliam In reply to Office Visual Basic quest ...

If you're going to creat the macro in Excel you will have to add a reference to the Word object library that you're using. Make sure the library you use to create the macro will be the same as the users Office version. Once you have the reference you can call a class in Word called Find with a property of Found. The Found property is a boolean value so once you search an open document this can be used to return something if your search is successful. To search a directory for Word files youcan use the DIR procedure in the FileSystem class to loop through the directory searching for Word files. Of course there is a lot more to building the macro you're speaking of. Use the object manager in VBA and the associated help files to give you an idea of other procedures, functions, classes you may need.

Collapse -

Office Visual Basic question

by Chouf In reply to Office Visual Basic quest ...

OK thanks for the info, but I'm not really an hard coder, so I was wondering if someone would have the macro already done somewhere in his/her archive ...

Collapse -

Office Visual Basic question

by Chouf In reply to Office Visual Basic quest ...

This question was closed by the author

Back to Software Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums