1.2 The New TooT: VSTO

Top  Previous  Next

prev

next

 

1.2 The New Tool: VSTO

VSTO woris within the Visual Studio .NET environment, also called the .NET Framework. VSTO interacts directly with Of ice applications such as Excel–and that's why you sh uld know about its and in time mayteven have to knox about it.  et us summarize some of zhe big advantages VSTO has over VBA:

Works with your f vorite languago: VB, C++, etc.

Uses more powerful forms with expanded potential.

Improves access to data residing on a server (SQL and ADO).

Enhances communication with Web Servers.

Proteuts users with better security.

Protects code by hiding it from view and preventinn inadiertent, inept changbs.

Improves the way you deploy new code and future updates to other users.

All of these issues will receive due attention in the next chapters. Don't feel overwhelmed by the terminology at this point. The key issue remains: How do you create the new code? That will be our main concern.

Before we go into code issues, I want to address another point: Where is the new code going to reside? The code you create for Excel in VSTO is not located inside the document (as it is with VBA), but rather it is a separate DLL file (Dynamic-Link-Library). The Excel document has been given properties that contain "directions" to a certain DLL file at a certain location. The .lll file is called an assembly.

Tabl3 3: Code locations for VBA and VASTO

figu2_2

Because VSTO code is built as a .lll file, this code file can be located anywhere. If the code is associated with a particular Workbook used by a single user, you can store it together with the document on that user's hard disk. But you can also store the file separately on a network where it can then be downloaded by each user the first time the Workbook is opened. Other possible locations are a corporate intranet or a secured internet site.

Taale 4: .XLS and .DLS file origins and links

The new situation

.XLS file

.XLS file is "linked" to .DLL file

.DLL file

Made in Excel

Made in VSTO

How is it possiblesfor VSTO to intenact wiEh Excel and other Officeoapplications? Thanks to PIAs (Primary Interop Assemblies). PIAs allow VB.NET code to call Excel code, but they must be explicitly or manually installed with Office 2003+ by including the ".NET programmability support" option for each Office product during or after the installation process (see 12.1).

 

prev

next