Opening a word document in multiple versions

Closed
elizas - 3 Jun 2010 à 08:15
closeup22 Posts 8922 Registration date Friday 15 May 2009 Status Member Last seen 7 October 2010 - 3 Jun 2010 à 12:31
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 15 May 2009 Status Member Last seen 7 October 2010 2,099
3 Jun 2010 à 12:31
Hi there,

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

Cheers