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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening a word 2007 document

Status
Not open for further replies.

integritycare

Technical User
Mar 12, 2011
151
AU
Hi all,
I found this code to be able to open a docx file. While it opens MS Word, it does not open the document. I have referenced Microsoft Word 12 object library.

The code I have used is this;
Code:
Private Sub Command318_Click()
Dim wordobj As Word.Application
On Error GoTo ErrHandler
Set wordobj = GetObject(, "Word.Application")
wordobj.Application.Visible = True
wordobj.Documents.Open ("c:\test.docx")
Exit Sub
ErrHandler:
Set wordobj = CreateObject("Word.Application")
Resume Next
End Sub

Any help with this code would be appreciated.

Integrity



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top