Opening a word document in multiple versions

Closed
elizas - Jun 3, 2010 at 08:15 AM
closeup22 Posts 8922 Registration date Friday May 15, 2009 Status Member Last seen October 7, 2010 - Jun 3, 2010 at 12:31 PM
The following tip can be used to avoid any problem in opening a word document in multiple versions of MS Word in different systems.

If we have a reference to Microsoft Word 8.0 Object Library and wrote the following code in VB.Net to open a word document.


Dim oWord As Word.ApplicationClass

oWard = CreateObject("Word.Application")
oWord.Visible = True
oWord.documents.Open(Application.StartupPath & "\File1.doc")


This method is called the Early binding way to programmatically control another application.

But above code may result in popping up an error message such as :

QueryInterface for interface for word._Application failed
at Word.ApplicationClass.set_Visible(Boolean prop)

http://burnignorance.com/vb-net-tricks/opening-a-word-document-in-multiple-versions-of-word-net-windows-application/
Related:

1 response

closeup22 Posts 8922 Registration date Friday May 15, 2009 Status Member Last seen October 7, 2010 2,099
Jun 3, 2010 at 12:31 PM
Hi there,

Thanks a lot for sharing this useful tip ,its really great.

Cheers
0