Login
`
Templates, Tools and Utilities
|
||
Add a comment to an Icetips ArticlePlease add your comments to this article.
Please note that you must provide both a name and a valid email address in order
for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!
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, 7:02 am This article has been viewed 35259 times.
|
|