Using the Microsoft Visual Studio Tools for the Microsoft Office System

Using the Microsoft Visual Studio Tools for the Microsoft Office System

ffice is a staple in most corporations, and .NET developers can easily take advantage of its power and omnipresence. The Visual Studio Tools for Office provide the ability to use .NET code with Office 2003 applications. With it, you can create code using Microsoft Visual Basic .NET (VB.NET) or C# (or other .NET languages) and integrate that code into your own Office 2003 tools.

Examining the Code
Once the wizard has run, you can examine the project it created. The first item to examine is the references added by the wizard. The wizard creates a project with all the standard .NET references (System, System.Data, System.XML, etc.) and it also adds references to Microsoft.Office.Core, Microsoft.Office.Interop.Word and Microsoft.VBE.Interop.Forms. These references are assemblies used to communicate with Office 2003 and are installed when you perform a complete installation of Office 2003. If you haven’t installed them from your Office 2003 CDs, the Visual Studio Tools for Office will do that for you.

The next item to examine is the class created by the wizard. The class created by the wizard is partially defined in Table 1.

Table 1: Definition of the class created by the Visual Studio Tools for Office Wizard.

Property/Method

Description

ThisDocument

Handle to the current document

ThisApplication

Handle to the current application

ThisDocument_Open

Subroutine called when the document opens

ThisDocument_Close

Subroutine called when the document is closed

FindControl()

Function that searches the current document for a handle to acontrol. Used for accessing controls added to a document

Range()

Returns a range object that can be manipulated in workbooks anddocuments. In Excel, a range can be defined as a cell or range ofcells.

Other functions and properties

There are literally hundreds of others. For the purposes of thisarticle, the ones defined above are the ones most commonly usedwhen integrating with Office.

Other items to note are the properties ThisDocument and ThisApplication (ThisDocument is known as ThisWorkbook in Excel 2003 projects). These variables are references to the current document and application. These two variables are cast as their proper Office data types in the _Startup() subroutine created by the wizard.

   Friend WithEvents ThisDocument AsCreating the Web Service
The first step is to create a Web service called ZipService with a WebMethod called GetZipInfo. To create a Web service, open the New Project dialog box in Visual Studio .NET. Select Create New ASP.NET Web service and call it ZipService. Add the following code to your Web service:

    _   Public Function GetZipInfo(ByVal cZip

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes

©2023 Copyright DevX - All Rights Reserved. Registration or use of this site constitutes acceptance of our Terms of Service and Privacy Policy.

Sitemap