We help IT Professionals succeed at work.

MS WORD 2010 and 2003 both installed on computer

MKadric
MKadric used Ask the Experts™
on
I use the code below to open a word dot file which the dot file is associated with 2003.  Which is what I want to open with, but 2010 keeps opening... I need to make sure 2003 always opens with the code below..


Public obj As Word.Application
Public wdApp As Word.Application
Public wdDoc As Word.Document      

      Set wdApp = CreateObject("word.application")
            Set wdDoc = wdApp.Documents.Open(strFilename)
            wdApp.Visible = True
            wdApp.WindowState = wdWindowStateNormal
            wdApp.Activate
            wdDoc.SaveAs strFilename
           
            objRecSet.Fields("Document Path") = strFilename
            objRecSet.Update

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Retired
Top Expert 2012
Commented:
Try:

Set wdApp = CreateObject("Word.Application.11")

Author

Commented:
Is there a way to test for  Word.Application.11. Word.Application.10 amd so on... Because now with the statment above a get a run time error because I do not have 2003 installed
GrahamSkanRetired
Top Expert 2012

Commented:
I don't know of one. I suggest that you trap the error.

Author

Commented:
Worked like a charm... Thanks