Lookup from entry in Word Table?

J

JonathanK

I currently have a word document that has a table.

I would like to create a process that would take each entry in the table
(done manually by the user) and compare this against a list that is in
another file (perhaps in excel, access, etc).

If a match is found, I would like to insert text into the third page of this
same word document, saying that a match was found.

Is this possible using VBA? Is there another avenue that would be easier?

Any help/suggestions would be greatly appreciated.

Thanks.
 
D

Doug Robbins - Word MVP

It is certainly possible using VBA.

See the article "Access a database and insert into a Word document the data
that you find there" at:

http://www.word.mvps.org/FAQs/InterDev/GetDataFromDB.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
J

JonathanK

Thanks for the information Doug.

Is there a book currently out there that you would recommend to explore
further this type of vba scripting?

Thanks!
 
J

JonathanK

Thanks Doug.

Is there a book out there that you would recommend for this type of VBA
scripting?

Thanks again.
 
D

Doug Robbins - Word MVP

There is a lot of good information on other pages of the website to which I
gave you the link. Another sorce of good information is the Visual Basic
Help file.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
D

David Horowitz

Jonathan,
As Doug mentioned, this is definitely all doable. VBA is definitely a great
way to go. Depending on your experience with VBA, you'd be tackling some
rather hefty topics for a beginner when you get into reading from Excel or
Access. I will tell you to read from Excel there are generally two ways to
do it: you can use the Excel Object Model, which means to set a reference in
VBA using Tools > References to the Microsoft Excel Object Library and then
you can use all the Excel objects, or you can use ADO to reference the Excel
data as a database. To access Access data, you'd generally use ADO. (Of
course, this is all pre-.NET info.)
To write stuff on the 3rd page of the document, you might want to use the
Selection.GoTo function to go to the third page and then you can insert text
with Selection.TypeText or Selection.InsertAfter. You might find working
with Range objects instead of the Selection object more complicated, but it
provides greater flexibility in the long run.
The mvps web site Doug mentioned is invaluable.
Good luck!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top