LPARAMETERS nFunction
LOCAL oleApp
IF PARAMETERS() = 0
** For populating data in the sheet
nFunction = 2
ENDIF
SELECT DISTINCT Table FROM tabledata INTO CURSOR tablenames
SELECT('tablenames')
nSheet = 1
SCAN
** For renaming sheet name.
IF nfunction = 1
WAIT WINDOW "Renaming Sheet" + ALLT(STR(nSheet)) + "..." NOWAIT
IF TYPE('OleApp') <> 'O'
** Get Current Instance
** oleapp = GETOBJECT('c:\temp\tempsheet.xls','Excel.Application')
oleapp = GETOBJECT('c:\temp\tempsheet.xls')
ENDIF
oleapp.worksheets("Sheet" + ALLTRIM(STR(nSheet))).name = ALLTRIM(TableNames.Table)
ELSE
WAIT WINDOW "Populating Sheet" + ALLT(STR(nSheet)) + "..." NOWAIT
h = DDEInitiate('Excel', 'Sheet' + ALLTRIM(STR(nSheet)))
nRow = 1
SELECT('tabledata')
SCAN FOR Table = TableNames.Table
cItemName1 = "R" + ALLTRIM(STR(nRow)) + "C1"
= DDEPoke(h, cItemName1, ALLTRIM(tabledata.Column))
cItemName2 = "R" + ALLTRIM(STR(nRow)) + "C2"
= DDEPoke(h, cItemName2, ALLTRIM(tabledata.Type))
cItemName3 = "R" + ALLTRIM(STR(nRow)) + "C3"
= DDEPoke(h, cItemName3, ALLTRIM(tabledata.Length))
cItemName4 = "R" + ALLTRIM(STR(nRow)) + "C4"
= DDEPoke(h, cItemName4, ALLTRIM(tabledata.nullable))
cItemName5 = "R" + ALLTRIM(STR(nRow)) + "C5"
= DDEPoke(h, cItemName5, ALLTRIM(tabledata.Desc))
nRow = nRow + 1
ENDSCAN
= DDETerminate(h)
ENDIF
nSheet = nSheet + 1
SELECT('tablenames')
ENDSCAN
RELEASE OleApp
This page was last updated on May 01, 2006 04:28 PM.