Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1449

Kingsoft Spreadsheet and VB6

$
0
0
Reading through the forums, there seems to be some confusion on how to create an Excel Spreadsheet using the Kingsoft Spreadsheet package via Automation with Visual Basic 6.

Here is sample source code;
Code:

Dim oExcel
Dim oBook
Dim oSheet

'Start a new workbook in Kingsoft Spreadsheet
Set oExcel = CreateObject("et.Application")
Set oBook = oExcel.Workbooks.Add

'Add data to cells of the first worksheet in the new workbook
Set oSheet = oBook.Worksheets(1)
oSheet.Range("A1").Value = "Last Name"
oSheet.Range("B1").Value = "First Name"
oSheet.Range("A1:B1").Font.Bold = True
oSheet.Range("A2").Value = "Dunn"
oSheet.Range("B2").Value = "Elias"

'Save the Workbook and Quit Excel
oBook.SaveAs "C:\utils\example.xls"
oExcel.Quit
'***********END***********

The free copy of Kingsoft Spreadsheet is available from http://www.kingsoftstore.com/spreadsheets-free.html

While this code was written for use with VBScript, it works the same in Visual Basic 6.

Elias

Viewing all articles
Browse latest Browse all 1449

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>