CLEAR ALL
#DEFINE STARTXL_LOC “Starting Excel……..”
#DEFINE ENDDATA_LOC “Transfer Finished..”
LOCAL xlsheet,XLApp,tmpsheet,n_hit,Title01,Title02

Title01 = “LIST OF EMPLOYEES”
Title02 = “COMPANY”

WAIT WINDOW STARTXL_LOC NOWAIT
tmpsheet=GetObject(”,’excel.sheet’)
XLApp=tmpsheet.application
XLApp.Visible=.t.
XLApp.WorkBooks.Add()
XLSheet=XLApp.ActiveSheet
XLSheet.Cells(1,01).Value = Title01
XLSheet.Cells(2,01).Value = Title02
XLSheet.Cells(4,01).Value = “ID”
XLSheet.Cells(4,02).Value = “NAME”
XLSheet.Cells(4,03).Value = “DIVISION”
XLSheet.Cells(4,04).Value = “DATE HIRED”

*!* Open table employee

USE employee AGAIN ALIAS ListEmployee IN 0
SELECT ListEmployee
GO TOP
n_hit = 5
SCAN FOR !EOF()
n_hit = n_hit + 1
XLSheet.Cells(n_hit,01).Value = ListEmployee.ID
XLSheet.Cells(n_hit,02).Value = ListEmployee.NAME
XLSheet.Cells(n_hit,03).Value = ListEmployee.DEPT
XLSheet.Cells(n_hit,04).Value = ListEmployee.DATEHIRED
ENDSCAN

*** NB.  If you want to export another data in another sheet in one workbook, you can add command

XLSheet=XLApp.Sheets(..SheetIndexNo…)

…Data you want to export….

WAIT WINDOW ENDDATA_LOC TIMEOUT 2
SELECT ListEmployee
USE

No related posts.

Leave a Reply







Trek Pay - Terbukti sudah membayar 5 Dollar

Usaha modal kecil!

Modern Bedroom Furniture

Click Here to Advertise on My Blog

Add to Technorati Favorites

blogarama - the blog directory