Login
`
Templates, Tools and Utilities
|
||
Icetips Article
Back to article list
Search Articles
Add Comment
Printer friendly
Direct link
Par2: OLE with Excell 2000-07-06 -- Davor Maric This sample creates a new Excel worksheet, fills in some data and saves the
file.
?ExcelOLE{PROP:ReportException} = True
?ExcelOLE{PROP:Create} = 'Excel.Application'
LOC:App = ?ExcelOLE{'Application'}
SaveSheets# = ?ExcelOLE{LOC:App & '.SheetsInNewWorkbook'}
?ExcelOLE{LOC:App & '.SheetsInNewWorkbook'} = 1
LOC:WBook = ?ExcelOLE{'Workbooks.Add()'}
?ExcelOLE{LOC:App & '.SheetsInNewWorkbook'} = SaveSheets#
LOC:WSheet = ?ExcelOLE{LOC:WBook & '.Worksheets(1)'}
?ExcelOLE{LOC:WSheet & '.Name'} = 'My Sheet'
?ExcelOLE{'Visible'} = -1
?ExcelOLE{LOC:WSheet & '.Activate'}
LOOP x# = 1 TO 3
?ExcelOLE{LOC:WSheet & '.Cells(1,' & CLIP(x#) & ').Value'} = 'Column ' &
CLIP(x#)
LOOP y# = 2 TO 10
?ExcelOLE{LOC:WSheet & '.Cells(' & CLIP(y#) & ',' & CLIP(x#) &
').Formula'} = '=RAND()*100'
END
END
LOC:FileName = 'C:\Temp\MyXls.xls'
?ExcelOLE{'Workbooks(1).SaveAs(' & CLIP(LOC:FileName) & ',,,,,,,,,,)'}
?ExcelOLE{'Workbooks(1).Close(0,,)'}
?ExcelOLE{LOC:App & '.Quit'}
You have to have an empty OLE container named ?ExcelOLE on your window.
Variables are declared as:
LOC:App CSTRING(21)
LOC:WBook CSTRING(21)
LOC:WSheet CSTRING(21)
LOC:FileName CSTRING(260)
> Does anybody have an example of using OLE (word, excel)? Trying to
figuring
> it out, but just can't get word or execl to open. No buttons to press.
Today is November 21, 2024, 3:37 am This article has been viewed 35258 times.
|
|