Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Using the Microsoft Visual Studio Tools for the Microsoft Office System : Page 2

In its previous versions, Microsoft has spent considerable time making Office available for integration with other Windows-based applications. The Visual Studio Tools for Office combine the vision of its predecessors with the functionality of the future in Office 2003.


advertisement
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 a control. Used for accessing controls added to a document

Range()

Returns a range object that can be manipulated in workbooks and documents. In Excel, a range can be defined as a cell or range of cells.

Other functions and properties

There are literally hundreds of others. For the purposes of this article, the ones defined above are the ones most commonly used when 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 As



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date