Creating Excel Spreadsheet files?

Geuis
04-04-2003, 07:22 PM
Is it possible, using VB, to create and write data to an Excel spreadsheet file? If so, is there a tutorial or existing code someone can point me to? Thanks.

Geuis

starbitz
04-04-2003, 07:43 PM
Is it possible, using VB, to create and write data to an Excel spreadsheet file? If so, is there a tutorial or existing code someone can point me to? Thanks.

Geuis

YES, there is.

In calling the Excel Application, you can have like this:
Dim AppExcel As Excel.Application
Dim wSheet As Worksheet
Dim wBook As Workbook

Set AppExcel = CreateObject("Excel.Application")
If AppExcel.Workbooks.Count = 0 Then
Debug.Print "Adding a new workbook"
Set wBook = AppExcel.Workbooks.Add
End If
Set wSheet = AppExcel.Sheets(1)

Now, for populating your excel sheet, you can use the Macro recorder of excel and copy&paste the macro code to your vb program :D

phinds
04-04-2003, 08:27 PM
there is an Excel tutorial project at the link below my name.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum