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

前端 未结 5 1282
借酒劲吻你
借酒劲吻你 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:10

    This may further explain why the code works some times and not others.

    My observation on the situation of the command

    'Set wordAppxxxx = CreateObject("Word.Application.xx")'
    

    working or not on your computer is that it is a function of the latest update you get from Microsoft.

    Why I believe this:

    I have an application that converts a text file to a Word document for backwards compatibility with some legacy apps. The best plan includes using a version of Word similar to the version the legacy apps were designed with/to. As a result, I searched on how to invoke a legacy version of Word as opposed to the default offering on my computer which is Word 2010.

    The solution noted in this discussion chain provided the answer to my question. (Thank you Stack Overflow contributors!) I wanted to use Word XP, so I looked at my directories and observed that Word XP (aka Word 2002) is a member of Office 10, so I created the command

    'Set wordApp2002 = CreateObject("Word.Application.10")'
    

    and my program launched Word 2002 and the world was a happy place.

    Over the weekened, I had an update to my computer. I control the updates via an app which gives me control over when updates occur such that I can observe changes to my configuration. This morning (9/30/13) I turned on a computer that had a Word update. I did not know this until after I had made one run of my app from last week. The app ran fine and invoked Word 2002 as expected.

    But then I got the banner page informing me of a Word 2010 update that was installing itself.

    Afterwards, I ran the app that worked so well for me last week and once today. Now, after the Word update (immediately after!), the same code now launches Word 2010 despite the fact that the command line invoking Word 2002 has not changed.

    This appears strong evidence that a Microsoft update tweaked the settings that previously allowed the VB code to work as expected. This might be a good item to bring to Microsoft's attention so see if we can get this item stabilized in subsequent update packages to allow consistent behavior in future releases.

    I hope this is helpful,

    JeffK

提交回复
热议问题