All Kingsoft Office applications (Kingsoft Writer, Kingsoft Spreadsheets and Kingsoft Presentation) are API compatible with Microsoft Office application automation. This allows you to automate Kingsoft applications through VBA. The example provided here shows how to automate Kingsoft Spreadsheets using VBScript. The original Microsoft Excel script came from Microsoft KB article 247412.

Kingsoft Spreadsheets VBA Example

Automating Kingsoft Spreadsheets

Before you can use any scripts written for Microsoft Excel, you will need to replace all instances of Excel.Application with et.Application. Copy the below code into a text file named example.vbs. This code will open Kingsoft Spreadsheets, add two rows of data, and save the file to C:\TEMP\example.xls.

Dim oExcel
Dim oBook
Dim oSheet

‘Start a new workbook in Kingsoft Presentation
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 = "Doe"
oSheet.Range("B2").Value = "John"

‘Save the Workbook and Quit Excel
oBook.SaveAs "C:\TEMP\example.xls"

Related Articles

  1. Kingsoft Office 2009 supports Microsoft Office (Word/Excel) API compatible OLE/C...
  2. Kingsoft Office 2009 is compatible with Microsoft Office Open XML (OOXML) format...
  3. Pivot table function in Kingsoft Spreadsheets is an alternative to Microsoft Exc...
  4. Kingsoft Spreadsheets can convert a Microsoft Excel workbook (XLS/XLSX/CSV/DBF) ...
  5. Kingsoft Spreadsheets is an alternative to Microsoft Excel 2003 that can open, v...

Tags: , ,

kingsoft office vba (77), kingsoft vba (31), Kingsoft Office (14), kingsoft office vb net (13), kingsoft office visual basic (11)