Re: Making & Saving Excel documents
Re: Making & Saving Excel documents
- Subject: Re: Making & Saving Excel documents
- From: "Duane L. Mitchell" <email@hidden>
- Date: Sun, 22 Jul 2001 11:56:33 -0400
Recording is helpful when scripting Excel. I couldn't find sample scripts
anywhere and the dictionary is so large that you almost don't know where to
begin. I think it is the largest dictionary of any application.
Here's a little sample:
tell application "Microsoft Excel"
Activate
Create New Workbook --to create a new Excel document
Create New Worksheet --to create a new worksheet in the document
Select Range "A1" --to select a cell using the familiar reference
Select Range "R1C1" --to select a cell using the R1C1 format
set NumberFormat of Selection to "@" --formatting a cell as text, very
intuitive
--a routine to build a spreadsheet one row of data at a time
set vExcelRowCounter to 2 --initialize a row counting variable to the
beginning row
set vSelectRange to "R" & vExcelRowCounter & "C1" --build the Excel
reference
Select Range vSelectRange --select the starting cell for that row
Select (Offset ActiveCell ColumnOffset 1) --move across the row one cell
Set vExcelRowCounter to vExcelRowCounter + 1 --increment the row counter
end tell
Have fun,
Duane