none
Targeetting a version of Office RRS feed

  • Question

  • I have written an application that calls word. My computer has Office 2007 on it but I wish the application to run on target machines that have Word 2010 (32 and 64 bit) installed as well.

    a. What do I have to install on my development computer ? 

    b. Do I have to make changes to calling code ? (as far as I know no difference)....

    c. What do I have to deploy ?

     

    Eli

    Thursday, July 14, 2011 6:20 PM

Answers

  • Hi Eli

    <<Now all I have to do is figure out why it doesn't actually work when I tested on a machine running Office 2010 Starter....>>

    The answer to that is simple, although perhaps not what you want to hear...

    The STARTER edition doesn't provide any APIs. No VBA, no PIAs, no OLE Server stuff. It's non-existant as far as use for programming goes.


    Cindy Meister, VSTO/Word MVP
    Sunday, July 17, 2011 6:39 AM
    Moderator

All replies

  • Hi Eli,

     

    Thanks for your post.

    I have written an application that calls word. My computer has Office 2007 on it but I wish the application to run on target machines that have Word 2010 (32 and 64 bit) installed as well.

    a. What do I have to install on my development computer ?

    b. Do I have to make changes to calling code ? (as far as I know no difference)....

    c. What do I have to deploy ?

    You should firstly know that developing an add-in for multiple version Office is not recommended. Moreover, Visual Studio doesn’t support for multiple version of Office in development machine.

     

    You can refer for more information in this blog:

    Why is VS development not supported with multiple versions of Office?

    VSTO solutions always try to host in the last registered Office version.

     

    So if you have VS 2010 and Office 2010 installed, you can create a Word add-in for both Word 2010 and Word 2007.

    However, the differences are:

    1.       If Word 2010 add-in can be complied and debug in development machine but 2007 can’t.

    2.       Word 2010 add-in will works on both Word 2010 32-bit and 64-bit (as long as the add-in targeting at “AnyCPU”) but not Word 2007

    3.      Word 2007 add-in can’t be complied and debugged in development machine. However, if you publish the add-in via ClickOnce, you will find that add-in can be installed in Office 2010 successfully  but no in Office 2007

    Actually, the point three makes no sense, but I think it can help you understand what will happens if multiple Office versions are installed in your development machine.

     

    So for your first question: if you are developing VSTO add-in, VS 2010 and either Office 2007, Office 2010 32-bit or Office 2010 64-bit are enough.

     

    For you second and third question, like I said previous: one add-in for multiple version Office is not recommended. However, if you want to go ahead anyway, here is a workaround for you:

    Can you build one add-in for multiple versions of Office?

    (How to deploy the add-in is also included in this blog)

     

    For some related information:

    Add-ins for Multiple Office Versions without PIAs

    Running Solutions in Different Versions of Microsoft Office

     

    I hope this helps.


    Best Regards, Calvin Gao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, July 15, 2011 8:07 AM
    Moderator
  • Hi Eli

    What kind of application is this, and which programming language is involved?

    Your development machine would need to have Office 2007 (the oldest version).

    Whether you have to make changes to the calling code will depend on the answers to the questions above and what parts of the object model you're targeting. Could you tell us a bit about what your application does?

    What you have to deploy also depends on the answers to the questions...


    Cindy Meister, VSTO/Word MVP
    Friday, July 15, 2011 10:31 AM
    Moderator
  • Hi,

    After reading a bit more AND reading my own question I realized I hadn't supplied enough information so here goes....

    Actually all I am doing in my application is what I think everyone calls "automating" Word. I use the Interop.Word to open a Word document that I supply as part of my installation, and as part of the application fill in bookmarks with data, for the purpose of printing a "report".

    My VB.NET code has the following line of code in the relevant class:

    Imports Word = Microsoft.Office.Interop.Word

    and I added a reference to the project to the Microsoft Word 12.0 Object Library which it finds in the \Windows\assembly\GAC\Microsoft.Office.Interop.Word\12.....etc.
    I would have expected (and maybe I am wrong....) that somehow I would be able to "tell" my application that when running in a target machine that has 2010 it should use whatever it has there OR I should be able to install by me the necessary component to do so....
    Hope I am clearer now....any help would be very appreciated.
    Thanks,
    Eli

     


    Eli Mandel
    Friday, July 15, 2011 12:18 PM
  • Hi Eli

    The Office 2007 and 2010 PIAs incorporate "binding redirects" which means that calls to an older PIA (2003 or 2007, respectively) will be re-routed to the newer PIA. So from the perspective there shouldn't be any problem. you don't need to do anything.

    If you're using Visual Studio 2010 then there's a good chance your solution doesn't even reference the PIAs; in that case it would be version-independent and could theoretically run against any version of Word.

    As best I can tell from your brief description, there wouldn't be any changes to expect in Word's object model for opening, writing to bookmarks, printing...

    You should, of course, test the application on an Office 2010 machine (not your dev machine with Office 2007 installed) to make sure everything's working as you'd expect.


    Cindy Meister, VSTO/Word MVP
    Friday, July 15, 2011 3:24 PM
    Moderator
  • Hi,

    First of all, I'm stuck in the meantime with VS2008, but according to what you've said it sounds reassuring and what I would have expected.... 

    Now all I have to do is figure out why it doesn't actually work when I tested on a machine running Office 2010 Starter....

    It's either that OR the fact that I used my "own" installation (innosetup and not the built-in Publish) although I can't see that any other files (PIA's or other) are being carried over...

     

     Eli


    Eli Mandel
    Saturday, July 16, 2011 6:48 PM
  • Hi Eli

    <<Now all I have to do is figure out why it doesn't actually work when I tested on a machine running Office 2010 Starter....>>

    The answer to that is simple, although perhaps not what you want to hear...

    The STARTER edition doesn't provide any APIs. No VBA, no PIAs, no OLE Server stuff. It's non-existant as far as use for programming goes.


    Cindy Meister, VSTO/Word MVP
    Sunday, July 17, 2011 6:39 AM
    Moderator
  •  

    HI!!!

    That's a GREAT answer and you have MADE MY DAY!!!

    After testing on another computer that had a "normal" Office and finding that everything worked fine I also began to have my doubts about the Office Starter. Your message confirms things.

    I have no problems specifying a base Office Suite for my applications so at least got that out of the way and can go back to sleeping at night....

    Thanks for your help.

    Eli 


    Eli Mandel
    Monday, July 18, 2011 10:15 AM