How to open specific version of Word 2007/2010 in Excel

前端 未结 5 1302
借酒劲吻你
借酒劲吻你 2020-12-11 16:20

I have both Word 2007 and 2010 installed. I need to open Word from within Excel but I need to specify which version I need to open within VBA.

I\'ve tried late bindi

5条回答
  •  无人及你
    2020-12-11 17:19

    This is a VB.NET solution:

    Sub Word_InfoLate()
    Dim wordApp2007 As Object
    Dim wordApp2010 As Object
    

    This is a bit intimidating to some, but there may be a registry edit that can solve this. I am unable to test as I only have one version of MS Office available to me, however, previous versions still have registry keys left over.

    I found the 2007 version of Word in the registry, and it's default location is C:\program Files\Microsoft Office\Office14\WINWORD.EXE" indicating that older versions of Word are registered to the newest version install location as it's new default.

    What you might be able to do is navigate to the registry location

    HKEY_CLASSES_ROOT\Word.Documet.12\shell\Open\Command 
    

    Change the (Default) key to read "C:\program Files\Microsoft Office\Office12\WINWORD.EXE" /n "%1"

    In theory whenever

    Set wordApp2007 = CreateObject("Word.Application.12")
    

    is invoked it may probe the registry for the location of the executable, and find the correct path.

提交回复
热议问题