One of the VSTO development

Source: Internet
Author: User

VSTO is Microsoft's launch of a technology for Office products that provides class libraries to make it easier for developers to develop Office solutions that extend functionality to Word/excel/outlook.

New->excel 2013 External Program

After the project has been created successfully

Only the ThisAddIn.cs file, which has the ThisAddIn_Startup and ThisAddIn_Shutdown two methods, can be known from the naming of two methods, if your code wants to run when the add-in is loaded, Put the code in the ThisAddIn_Startup method content, and if you want to run your code when the add-in is unloaded, put the code inside the ThisAddIn_Shutdown method.

usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Xml.Linq;usingExcel =Microsoft.Office.Interop.Excel;usingOffice =Microsoft.Office.Core;usingMicrosoft.Office.Tools.Excel;usingSystem.Windows.Forms;namespaceexceladdin1{ Public Partial classThisAddIn {Private voidThisAddIn_Startup (Objectsender, System.EventArgs e) {MessageBox.Show ("Welcome to Microsoft Excel"); }        Private voidThisAddIn_Shutdown (Objectsender, System.EventArgs e) {MessageBox.Show ("Thanks for using! "); }        #regionCode generated by VSTO/// <summary>        ///The Designer supports the required method-do not///Use the Code Editor to modify the contents of this method. /// </summary>        Private voidInternalstartup () { This. Startup + =NewSystem.EventHandler (ThisAddIn_Startup);  This. Shutdown + =NewSystem.EventHandler (ThisAddIn_Shutdown); }                #endregion    }}

After adding the code F5 run, you can see windows that are welcome to Microsoft Excel when you start Excel, and a thank you window when exiting.

One of the VSTO development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.