Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying certain info from word to access table

Status
Not open for further replies.

tazbrown

Programmer
Feb 13, 2002
7
0
0
US
I am currently working on a project that requires me to read the currently opened word document and read certain areas of the document for information. This information needs to be updated into a table in Access. I don't know how to go about stepping thru the document to get the particular information that I need. Any help would be much appreciated.
Tazbrown
 
User bookmarks for different areas within a word document. When you open this document in code, you can read these book marks and copy thier contents to your local variables.
In order to create bookmarks, highlight a region in Word and right-click to set a book-mark. I have pasted some sample code that shows how to access a bookmark in word.

Dim wWord As Object
Dim wDoc As Object
Dim wRange As Object
Dim inputVar as string

Set wWord = CreateObject("Word.Application")
Set wDoc = wWord.Documents.Open(docDestination)
If wDoc.Bookmarks.Exists("Fromname") Then
Set wRange = wDoc.Bookmarks("Fromname").Range
inputVar = wRange.Text
End If

set wWord = nothing
set wDoc = nothing
set wRange = nothing


If your word documents are created everyday, create them from a template that already has these bookmarks e.g:
FileCopy formLetterSource, formletterDestination
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top