MySQL Forums
Forum List  »  Microsoft Access

Re: MS Access, MS Word & SQL
Posted by: Sebastien Caisse
Date: November 08, 2005 10:39PM

This is simple yet complex given there is little background surrounding the question...

I'll be assuming you know Access+VBA, MDAC or DAO, since this is after all a mySQL "Access" forum.

I'm also assuming that you wish to extract the text data from the word document (rather then say, save the binary file or extract specific data from it - otherwise, refer to the Word VB documentation). Finally, it also assumes you have the table created and already linked (though not having it previously linked is trivial coding to add).

1) Set yourWordApp = CreateObject("Word.Application")
2) Set yourDoc = Word.Documents.Open("Your file path and name")
4) Set yourRecordset = CurrentDB.OpenRecordset("YourTable")
yourRecordset.AddNew
5) yourRecordset("YourTextDocumentColumn") = yourdoc.Range(0).Text
6) yourRecordset.Update
7) yourWordApp.Quit ' To make sure to close WINWORD process

This is a pretty bare bones example and is not real code, albeit the object methods used should be exact (pending perhaps a spelling check or just a memory lapse from my part ;). There are also plenty of things you could do to make the code better.



Edited 3 time(s). Last edit at 11/08/2005 10:46PM by Sebastien Caisse.

Options: ReplyQuote


Subject
Views
Written By
Posted
2568
November 08, 2005 02:11PM
Re: MS Access, MS Word & SQL
2110
November 08, 2005 10:39PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.