locked
Embedded an Excel Add-In in a Excel 2007 workbook RRS feed

  • Question

  • Is it possible to embedded an Excel Add-In in a Excel 2007 workbook?

    So that when user open the workbook, the Excel Add-In can be automatically loaded and installed?

    Tuesday, January 22, 2008 10:34 AM

Answers

  • VSTO 2005 can only develop document-level customizations for Office 2003. These can (usually) run in Office 2007 but can't take advantage of the Ribbon or the CustomTaskPane technology. VSTO 2008 can develop document-level customizations for both 2003 and 2007. Since you have Office 2007 and want to develop specifically for that format, you should use VSTO 2008.

     

    Distributing a managed code (.NET) solution will always involve more than one file. You'll always have, at the very least, the document (workbook) and the DLL containing the code. They don't have to be in the same folder on the machine. Just as with any software program, the solution should be distributed in a manner that takes care of everything for the user. In this respect, VSTO 2008 is "friendlier" than VSTO 2005. VSTO 2008 can use ClickOnce technology that makes everything transparent to the user; with a VSTO 2008 solution for Office 2007 the user can open the document in order to trigger installation of the solution. See

    http://msdn2.microsoft.com/en-us/library/bb608592.aspx

     

    Just to clarify: if you use anything other than VBA embedded in the workbook you will have to distribute more files than just the workbook. There is no alternative to VBA if you want to work with a single file, only.
    Thursday, January 24, 2008 9:14 AM

All replies

  • I'm not certain I understand the scenario you have in mind...

     

    Technically, an "Add-in" is something that runs at the application level. If you want code to be workbook-specific, it's more common to link the code with the workbook (or a template from which a specific type of workbook is created). This code can be in the workbook (Excel's "native" VBA) or it can be a VSTO document-level customization (which means you'd need VS2008 Pro or higher).

     

    Theoretically, you could have some code linked to the workbook that would load/unload an Add-in. But it would be a lot more work to keep the Add-in workbook-specific, and you'd still need that bit of code linked to the workbook.

     

    An alternate approach could be an Add-in that uses events to determine when a particular workbook is open/has the focus and only provides its tools under that circumstance.

     

    Does this help at all?

     

    Tuesday, January 22, 2008 2:09 PM
  •  

    According to your replay "it can be a VSTO document-level customization (which means you'd need VS2008 Pro or higher)", I want to know more details about it. Would you give me some links for reference?

     

    Is it possible to write .NET programming logics linked with Ribbon buttons in a workbook instead of VBA? Currently, I have done some VBA codes which create a drop-down cell in a worksheet. Could I use .NET language (like C#) to do so?

     

    Thanks for your reply!

    Wednesday, January 23, 2008 2:10 AM
  •  ms_matthew wrote:

     

    According to your replay "it can be a VSTO document-level customization (which means you'd need VS2008 Pro or higher)", I want to know more details about it. Would you give me some links for reference?

     

    Here's a link to the starting page for the VSTO documentation on MSDN

    http://msdn2.microsoft.com/en-us/library/d2tx7z6d.aspx

     

    You may also want to look through the posts "pinned" to the top of the forum for more information and links.

     

    Is it possible to write .NET programming logics linked with Ribbon buttons in a workbook instead of VBA? Currently, I have done some VBA codes which create a drop-down cell in a worksheet. Could I use .NET language (like C#) to do so?

    Yes, the VSTO 2008 "Designer" for document-level customizations provides Ribbon support. There are two options:

    - the Ribbon designer. This lets you drag-and-drop controls to a "Ribbon" and set many of the properties in a ".NET-developer-friendly" way. It does not, however, give you access to the full spectrum of what the Ribbon can do

     

    - working directly against the Ribbon interface. You have to type the XML yourself, but you get the advantage of the standard Visual Studio XML editor Intellisense (the schema is interpreted for you and valid elements listed). Using this method you can take advantage of everything the Ribbon offers.

     

    The Ribbon and it's code are associated with the document.

     

    VSTO enables you to use WinForms controls in Word and Excel documents. So you can put a WinForms dropdown on an Excel spreadsheet (either at design or run-time), use its events and properties, and code against it in VB.NET or C# (those are the only two languages VSTO supports).

     

    Wednesday, January 23, 2008 5:05 PM
  • What is the difference between using VS2005 and VS2008 to develop VSTO project?

    Is it only VS2008 can develop document-level customization (since you specify VS2008 in your last post)?

     

    As I read MSDN documentation, it said that four types of files are needed to be deployed:

    • Excel workbook file
    • assembly file (which containing my codes)
    • deployment manifest (if applicable)
    • application manifest (if applicable)

    And I know that an Excel workbook file is only a zip, may I put those assembly file inside that zip?

     

    My problem is: I want the deployment as simplest as it can.

    I want the user enjoy our customized functions in the workbook, but not install extra software like add-ins (this is my questin in the first post). Even now the assembly file we don't want user to see it.

     

    Since my knowledge from MSDN, users have to get the workbook file AND assembly file, so that they can enjoy our developed features. Is it possible to combine them into one? I want the assembly file tranparent to user.

     

    Thanks for your reply.

    Thursday, January 24, 2008 1:58 AM
  • VSTO 2005 can only develop document-level customizations for Office 2003. These can (usually) run in Office 2007 but can't take advantage of the Ribbon or the CustomTaskPane technology. VSTO 2008 can develop document-level customizations for both 2003 and 2007. Since you have Office 2007 and want to develop specifically for that format, you should use VSTO 2008.

     

    Distributing a managed code (.NET) solution will always involve more than one file. You'll always have, at the very least, the document (workbook) and the DLL containing the code. They don't have to be in the same folder on the machine. Just as with any software program, the solution should be distributed in a manner that takes care of everything for the user. In this respect, VSTO 2008 is "friendlier" than VSTO 2005. VSTO 2008 can use ClickOnce technology that makes everything transparent to the user; with a VSTO 2008 solution for Office 2007 the user can open the document in order to trigger installation of the solution. See

    http://msdn2.microsoft.com/en-us/library/bb608592.aspx

     

    Just to clarify: if you use anything other than VBA embedded in the workbook you will have to distribute more files than just the workbook. There is no alternative to VBA if you want to work with a single file, only.
    Thursday, January 24, 2008 9:14 AM