Article ID: 235883
If you want to use a spreadsheet or calculation engine in your custom Visual Basic solution, you can use the Spreadsheet control included with the Microsoft Office Web Components. This article discusses how to insert a spreadsheet as a control on a Visual Basic form and populate the spreadsheet with data.
You can add the Office Web Components to a form in Visual Basic in the same way that you add any other ActiveX control. The Spreadsheet control included with the Office Web Components is a more robust option than the DataGrid control that ships with Visual Basic. Use the spreadsheet data to display formatted data, calculate formulas and allow user interactivity.
IMPORTANT: To view and work with any of the Office Web Components, you must have them installed on your computer. The components are installed with Microsoft Office 2000, or, if your company has an Office 2000 site license, the components can be downloaded from your Intranet. Your users must have these components installed as well, and must be covered by an Office 2000 license. You and your users must use Microsoft Internet Explorer version 4.01 or later.
Steps to Create a Sample Project
Populating a Spreadsheet ControlYou can add data to a Spreadsheet control in one of the following ways:
The following procedure populates and formats a Spreadsheet control with data from the sample database Northwind (NWind.mdb):
Note that a Spreadsheet control is not a Workbook and contains only a single sheet. The ActiveSheet property always refers to that single sheet.
Getting HelpAfter you create a reference to the Office Web Components library, you can access Help through the object browser or from the General tab of the Spreadsheet Property Toolbox. You can also locate and double-click the Help file Msowcvba.chm. To get help on a specific keyword, highlight the keyword and press the F1 key. For information about creating references and using object model Help, see Help in Visual Basic or Visual Basic for Applications.
You can bind a Chart control to a Spreadsheet control. For additional information on the Chart control, please click the article number below to view the article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/235885/EN-US/ )How To Use the Chart Web Component With VB
For more information about Office Web Components, see Chapter 12, "Using Web Technologies," in the Microsoft Office 2000/Visual Basic Programmer's Guide.
Article ID: 235883 - Last Review: June 19, 2014 - Revision: 2.0
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.