Data reports contain a list of information visible on your Visual Basic form. These reports are held in a control called a "DataGrid." The grid lays out and formats the data for your software users, so they can scroll through each record. Each record is contained in cells, similar to the layout of an Excel spreadsheet. You can automate selection of these records using Visual Basic code. This is beneficial when you want to select default records for your users.
- Skill level:
Other People Are Reading
Set up the Excel object. The Excel object library contains the methods and properties you need to create, edit and display a spreadsheet. The following code initialises this object:
Set excel = CreateObject("Excel.Application")
Write the data to the Excel spreadsheet. You don't need to write data to display a spreadsheet, but the programmer typically enters some data to the spreadsheet before rendering it to the user. The following code writes a simple string in the first cell of the spreadsheet:
excel.ActiveCell.FormulaR1C1 = "Display this Spreadsheet"
Display the spreadsheet to the user. The form retrieves the MIME type, which indicates that the display properties are an Excel spreadsheet. The following code clears the screen and displays the spreadsheet to your reader:
response.Charset = ""
response.ContentType = "application/vnd.ms-excel"
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for