VB 2010 Open Word Document

D. Bermudez picture D. Bermudez · Oct 23, 2012 · Viewed 16.7k times · Source

I need to open an existing Word document from within my VB 2010 application and detect when the user has closed the document in order to copy that document to a database, whether the user modified it or not. How do I accomplish this? Thanks.

Example:

'Code here
Dim word as New Word.Application()
Dim doc as New Word.Document()

'open the document here and let the user work on the word document
'detect when user has closed Word
'copy the word document into database

Answer

lhan picture lhan · Oct 23, 2012

Here is an example on how to create a new document. Maybe this will get you started?

http://support.microsoft.com/kb/316383

Another good example:

http://www.codeproject.com/Articles/55685/Word-Automation-using-VB-NET-Part-I