
Try to use this code:
Imports Microsoft.Office.Interop.Word
Imports System.Runtime.InteropServices
'public declaration'
Public oWord As Word.Application = Nothing
'in your class '
Sub your_procedure()
Try
oWord = WDExist()
Catch
msgbox("You do not have MS Word installed")
Exit sub
End Try
Dim WordFilePath$ = "c:\your.docx"
Dim WordDok As Word.Document = oWord.Documents.Open(WordFilePath, ,True)
'... do somenthing with this document'
end sub
Public Function WDExist() As Object
Try
oWord = CType(Marshal.GetActiveObject("Word.Application"), Word.Application)
Catch ex As Exception
If oWord Is Nothing Then oWord = GetObject(, "Word.Application")
Finally
If oWord Is Nothing Then oWord = CType(CreateObject("Word.Application"), Word.Application) 'not visible yet'
End Try
Return oWord
End Function
And Happy New Year.