10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Collections// Index into the workbooks collection through a string// constant and set an attribute of the workbook// being indexed.wbs['samples.xls'].author = 'Sam';// Index into the workbooks collection through an integer// variable and set an attribute of the workbook// being indexed.x = 1;wbs[x].author = 'Sally';// Index into the workbooks collection through an integer// variable and set an attribute of the workbook// being indexed.y = 'samples.xls';wbs[y].author = 'unknown';// Index into the workbooks collection through a string// constant and call a method of the workbook being// indexed.wbs['samples.xls'].close(TRUE,'c:\save.xls',FALSE);// Quit Excel.app.quit();endIn the preceding code, the Workbooks method returns a Workbooks collectionof Workbook objects. The following sections show various ways of indexing intothis collection.How You Can Index into an Undeclared CollectionThe following code shows how to index into a collection when the collection hasnot been defined to OpenROAD as a collection:initialize()=declareapp = application;wbs = workbooks;x = integer;y = varchar(20);awbs = array of workbook;enddeclarebegin// Show Microsoft Excelapp.visible = 1;// Get the workbooks collectionwbs = app.workbooks();Working with Arrays, Table Fields, and Collections 255

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!