Excel 2004 AppleScript Reference
Information in this document, including URL and other Internet Web site references, is subject to change
without notice. Unless otherwise noted, the example companies, organizations, products, domain names,
e-mail addresses, logos, people, places, and events depicted herein are fictitious, and no association with any
real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or
should be inferred. Complying with all applicable copyright laws is the responsibility of the user. Without
limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a
retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording,
or otherwise), or for any purpose, without the express written permission of Microsoft Corporation.
Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights
covering subject matter in this document. Except as expressly provided in any written license agreement from
Microsoft, the furnishing of this document does not give you any license to these patents, trademarks,
copyrights, or other intellectual property.
© 2004 Microsoft Corporation. All rights reserved.
Microsoft, MS-DOS, Windows, Windows NT, Windows Server, Entourage, Hotmail, and PowerPoint are either
registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.
The names of actual companies and products mentioned herein may be the trademarks of their respective
owners.
Using the Excel Dictionary
3
Using the Excel Dictionary
About the Excel AppleScript Dictionary ...................................................................................................................13
Activating a workbook ................................................................................................................................................14
Creating a new workbook...........................................................................................................................................14
Opening a workbook ...................................................................................................................................................14
Referring to sheets by name........................................................................................................................................ 14
Referring to sheets by index number.........................................................................................................................15
How to reference cells and ranges .............................................................................................................................15
Selecting and activating cells ......................................................................................................................................18
Working with the active cell .......................................................................................................................................19
Microsoft Office Suite Classes
assistant .........................................................................................................................................................................21
balloon checkbox..........................................................................................................................................................24
balloon ...........................................................................................................................................................................25
balloon label..................................................................................................................................................................29
command bar ................................................................................................................................................................ 29
command bar button....................................................................................................................................................33
command bar combobox.............................................................................................................................................34
command bar control...................................................................................................................................................36
command bar popup....................................................................................................................................................39
custom document property.........................................................................................................................................39
document property ......................................................................................................................................................39
web page font................................................................................................................................................................41
Microsoft Office Suite Commands
add item to combobox .................................................................................................................................................43
clear combobox .............................................................................................................................................................43
execute ...........................................................................................................................................................................44
get combobox item .......................................................................................................................................................45
get count of combobox items ......................................................................................................................................45
remove an item from combobox.................................................................................................................................46
reset ................................................................................................................................................................................46
show balloon.................................................................................................................................................................47
Using the Excel Dictionary
4
Microsoft Excel Suite Classes
add in .............................................................................................................................................................................50
application..................................................................................................................................................................... 51
autofilter ........................................................................................................................................................................64
border.............................................................................................................................................................................64
button.............................................................................................................................................................................66
calculated field..............................................................................................................................................................70
calculated item..............................................................................................................................................................70
chart sheet......................................................................................................................................................................71
checkbox ........................................................................................................................................................................72
child item.......................................................................................................................................................................74
column field ..................................................................................................................................................................75
custom view .................................................................................................................................................................. 75
data field........................................................................................................................................................................76
default web options......................................................................................................................................................76
dialog .............................................................................................................................................................................80
document.......................................................................................................................................................................80
dropdown......................................................................................................................................................................80
Excel comment..............................................................................................................................................................83
filter................................................................................................................................................................................ 83
format condition ...........................................................................................................................................................84
graphic ........................................................................................................................................................................... 86
groupbox ....................................................................................................................................................................... 88
hidden field ...................................................................................................................................................................90
hidden item ...................................................................................................................................................................91
horizontal page break ..................................................................................................................................................91
hyperlink .......................................................................................................................................................................92
international macro sheet............................................................................................................................................94
label ................................................................................................................................................................................ 94
list column.....................................................................................................................................................................96
list object........................................................................................................................................................................97
list row ...........................................................................................................................................................................99
listbox............................................................................................................................................................................. 99
macro sheet .................................................................................................................................................................102
named item..................................................................................................................................................................102
ODBC error .................................................................................................................................................................104
option button ..............................................................................................................................................................105
outline ..........................................................................................................................................................................107
page field..................................................................................................................................................................... 108
page setup ...................................................................................................................................................................109
pane.............................................................................................................................................................................. 115
parent item .................................................................................................................................................................. 115
phonetic ....................................................................................................................................................................... 116
pivot cache...................................................................................................................................................................117
pivot field ....................................................................................................................................................................119
pivot formula .............................................................................................................................................................. 124
pivot item ....................................................................................................................................................................125
pivot table....................................................................................................................................................................127
query table...................................................................................................................................................................132
recent file .....................................................................................................................................................................139
row field.......................................................................................................................................................................140
scenario........................................................................................................................................................................140
scrollbar .......................................................................................................................................................................141
sheet .............................................................................................................................................................................143
spinner .........................................................................................................................................................................147
Using the Excel Dictionary
5
textbox..........................................................................................................................................................................149
validation.....................................................................................................................................................................153
vertical page break ..................................................................................................................................................... 156
web options.................................................................................................................................................................157
window........................................................................................................................................................................160
workbook.....................................................................................................................................................................165
worksheet .................................................................................................................................................................... 171
Microsoft Excel Suite Commands
accept all changes.......................................................................................................................................................175
activate next ................................................................................................................................................................175
activate object.............................................................................................................................................................. 176
activate previous ........................................................................................................................................................176
add chart autoformat ................................................................................................................................................. 176
add custom list............................................................................................................................................................177
add data validation ....................................................................................................................................................177
add fields to pivot table............................................................................................................................................. 178
add item to list............................................................................................................................................................ 179
add to favorites...........................................................................................................................................................179
auto show ....................................................................................................................................................................180
auto sort.......................................................................................................................................................................180
break link.....................................................................................................................................................................181
bring to front...............................................................................................................................................................181
calculate ....................................................................................................................................................................... 181
calculate full ................................................................................................................................................................ 182
cancel refresh .............................................................................................................................................................. 182
centimeters to points..................................................................................................................................................182
change data type of list column................................................................................................................................ 183
change file access........................................................................................................................................................ 184
change link ..................................................................................................................................................................184
change scenario...........................................................................................................................................................185
check spelling.............................................................................................................................................................. 185
check spelling for........................................................................................................................................................186
circle invalid................................................................................................................................................................186
clear arrows.................................................................................................................................................................187
clear circles ..................................................................................................................................................................187
clear contents ..............................................................................................................................................................187
convert formula .......................................................................................................................................................... 188
convert to range..........................................................................................................................................................188
copy object................................................................................................................................................................... 189
copy picture.................................................................................................................................................................189
copy worksheet...........................................................................................................................................................189
create new document.................................................................................................................................................189
create summary for scenarios ...................................................................................................................................190
cut.................................................................................................................................................................................190
delete chart autoformat .............................................................................................................................................191
delete custom list........................................................................................................................................................191
delete number format ................................................................................................................................................191
double click .................................................................................................................................................................192
edit................................................................................................................................................................................192
Excel comment text ....................................................................................................................................................193
Excel repeat ................................................................................................................................................................. 193
exclusive access...........................................................................................................................................................194
execute excel 4 macro................................................................................................................................................. 194
Using the Excel Dictionary
6
follow ........................................................................................................................................................................... 195
follow hyperlink .........................................................................................................................................................195
get border ....................................................................................................................................................................196
get clipboard formats.................................................................................................................................................197
get custom list contents .............................................................................................................................................197
get custom list num ....................................................................................................................................................197
get dialog .....................................................................................................................................................................198
get file converters .......................................................................................................................................................200
get FileMaker criteria................................................................................................................................................. 200
get international..........................................................................................................................................................200
get list item..................................................................................................................................................................201
get open filename .......................................................................................................................................................201
get pivot table data..................................................................................................................................................... 201
get previous selections...............................................................................................................................................201
get registered functions .............................................................................................................................................201
get save as filename ................................................................................................................................................... 202
get subtotals ................................................................................................................................................................203
get values.....................................................................................................................................................................204
get visible fields ..........................................................................................................................................................204
get webpage font ........................................................................................................................................................ 204
goto............................................................................................................................................................................... 205
help...............................................................................................................................................................................205
highlight changes options .........................................................................................................................................206
inches to points........................................................................................................................................................... 206
input box......................................................................................................................................................................207
intersect........................................................................................................................................................................208
item selected................................................................................................................................................................208
large scroll ...................................................................................................................................................................209
link info........................................................................................................................................................................209
link sources..................................................................................................................................................................210
list formulas ................................................................................................................................................................ 210
merge scenarios .......................................................................................................................................................... 210
merge workbook......................................................................................................................................................... 211
modify..........................................................................................................................................................................211
modify condition ........................................................................................................................................................213
new window on workbook.......................................................................................................................................213
next Excel comment ................................................................................................................................................... 214
on key........................................................................................................................................................................... 214
on repeat......................................................................................................................................................................216
open FileMaker file ....................................................................................................................................................217
open links .................................................................................................................................................................... 217
open text file................................................................................................................................................................ 218
open workbook........................................................................................................................................................... 220
paste special on worksheet........................................................................................................................................221
paste worksheet..........................................................................................................................................................222
pivot select...................................................................................................................................................................223
previous Excel comment ........................................................................................................................................... 224
print out.......................................................................................................................................................................224
print preview ..............................................................................................................................................................225
protect sharing............................................................................................................................................................225
protect workbook .......................................................................................................................................................226
protect worksheet....................................................................................................................................................... 226
purge change history now......................................................................................................................................... 227
refresh .......................................................................................................................................................................... 227
refresh all.....................................................................................................................................................................228
refresh query table...................................................................................................................................................... 228
refresh table................................................................................................................................................................. 229
Using the Excel Dictionary
7
register xll....................................................................................................................................................................229
reject all changes......................................................................................................................................................... 230
remove all items .........................................................................................................................................................230
remove item ................................................................................................................................................................230
remove user................................................................................................................................................................. 231
reset all page breaks ...................................................................................................................................................231
reset colors...................................................................................................................................................................231
run auto macros..........................................................................................................................................................232
run VB Macro.............................................................................................................................................................. 232
save as..........................................................................................................................................................................233
save workbook as .......................................................................................................................................................234
save workspace........................................................................................................................................................... 236
scroll workbook tabs ..................................................................................................................................................236
send to back.................................................................................................................................................................237
set background picture .............................................................................................................................................. 237
set default chart .......................................................................................................................................................... 237
set FileMaker criteria..................................................................................................................................................238
set list item...................................................................................................................................................................239
set subtotals................................................................................................................................................................. 239
show.............................................................................................................................................................................240
show all data ...............................................................................................................................................................242
show custom view...................................................................................................................................................... 242
show data form........................................................................................................................................................... 242
show levels..................................................................................................................................................................243
show pages.................................................................................................................................................................. 243
small scroll...................................................................................................................................................................244
undo .............................................................................................................................................................................244
union ............................................................................................................................................................................ 245
unprotect ..................................................................................................................................................................... 245
unprotect sharing .......................................................................................................................................................246
update .......................................................................................................................................................................... 246
update from file .......................................................................................................................................................... 246
update link ..................................................................................................................................................................247
use default folder suffix.............................................................................................................................................247
wait............................................................................................................................................................................... 247
web page preview ...................................................................................................................................................... 247
Drawing Suite Classes
arc .................................................................................................................................................................................249
callout...........................................................................................................................................................................253
callout format..............................................................................................................................................................254
connector format ........................................................................................................................................................257
fill format..................................................................................................................................................................... 259
line................................................................................................................................................................................ 264
line format ...................................................................................................................................................................266
oval...............................................................................................................................................................................270
picture..........................................................................................................................................................................274
picture format .............................................................................................................................................................274
rectangle ......................................................................................................................................................................276
shadow format............................................................................................................................................................ 279
shape ............................................................................................................................................................................ 280
shape connector .......................................................................................................................................................... 285
shape line.....................................................................................................................................................................286
shape textbox ..............................................................................................................................................................286
Using the Excel Dictionary
8
text frame.....................................................................................................................................................................287
threeD format..............................................................................................................................................................290
word art ....................................................................................................................................................................... 293
word art format ..........................................................................................................................................................295
Drawing Suite Commands
apply ............................................................................................................................................................................299
automatic length......................................................................................................................................................... 300
begin connect ..............................................................................................................................................................300
begin disconnect......................................................................................................................................................... 301
bring to front (drawing)............................................................................................................................................. 301
check spelling (drawing) ...........................................................................................................................................302
copy object (drawing) ................................................................................................................................................ 302
copy picture (drawing) ..............................................................................................................................................303
custom drop ................................................................................................................................................................303
custom length..............................................................................................................................................................304
cut (drawing) ..............................................................................................................................................................304
end connect .................................................................................................................................................................305
end disconnect............................................................................................................................................................ 306
flip ................................................................................................................................................................................ 306
one color gradient....................................................................................................................................................... 306
patterned .....................................................................................................................................................................307
pick up ......................................................................................................................................................................... 308
preset drop ..................................................................................................................................................................308
preset gradient............................................................................................................................................................309
preset textured ............................................................................................................................................................310
reroute connections ....................................................................................................................................................310
reset rotation ...............................................................................................................................................................311
scale height..................................................................................................................................................................312
scale width...................................................................................................................................................................313
send to back (drawing) ..............................................................................................................................................313
set extrusion direction................................................................................................................................................314
set shapes default properties ....................................................................................................................................315
set threed format ........................................................................................................................................................ 315
solid..............................................................................................................................................................................316
toggle vertical text ......................................................................................................................................................316
two color gradient ...................................................................................................................................................... 317
user picture..................................................................................................................................................................318
user textured ............................................................................................................................................................... 318
z order.......................................................................................................................................................................... 318
Text Suite Classes
character ......................................................................................................................................................................319
font ...............................................................................................................................................................................320
style ..............................................................................................................................................................................322
Using the Excel Dictionary
9
Text Suite Commands
get border (text) ..........................................................................................................................................................326
insert into.....................................................................................................................................................................326
Table Suite Classes
cell ................................................................................................................................................................................327
column .........................................................................................................................................................................327
range ............................................................................................................................................................................328
row ...............................................................................................................................................................................337
Table Suite Commands
activate object (table).................................................................................................................................................. 339
add comment .............................................................................................................................................................. 339
advanced filter ............................................................................................................................................................ 340
apply names ................................................................................................................................................................340
apply outline styles ....................................................................................................................................................341
autocomplete............................................................................................................................................................... 341
autofill..........................................................................................................................................................................342
autofilter range ...........................................................................................................................................................342
autofit........................................................................................................................................................................... 343
autoformat................................................................................................................................................................... 344
auto outline .................................................................................................................................................................345
border around............................................................................................................................................................. 345
calculate (table)...........................................................................................................................................................346
check spelling (table).................................................................................................................................................. 347
clear contents (table) ..................................................................................................................................................347
clear Excel comments................................................................................................................................................. 347
clear outline.................................................................................................................................................................348
clear range ...................................................................................................................................................................348
clear range formats.....................................................................................................................................................348
column differences.....................................................................................................................................................348
consolidate...................................................................................................................................................................349
copy picture (table) ....................................................................................................................................................350
copy range ................................................................................................................................................................... 350
create names................................................................................................................................................................351
cut range...................................................................................................................................................................... 351
data series....................................................................................................................................................................352
data table .....................................................................................................................................................................352
delete range.................................................................................................................................................................353
fill down.......................................................................................................................................................................353
fill left...........................................................................................................................................................................354
fill right ........................................................................................................................................................................354
fill up............................................................................................................................................................................ 354
find ............................................................................................................................................................................... 355
find next.......................................................................................................................................................................356
find previous...............................................................................................................................................................357
function wizard ..........................................................................................................................................................358
get address ..................................................................................................................................................................358
Using the Excel Dictionary
10
get address local ......................................................................................................................................................... 359
get border (table) ........................................................................................................................................................359
get end .........................................................................................................................................................................360
get offset ......................................................................................................................................................................360
get resize......................................................................................................................................................................361
get XML value............................................................................................................................................................. 361
goal seek ......................................................................................................................................................................361
group............................................................................................................................................................................ 362
insert indent ................................................................................................................................................................363
insert into range..........................................................................................................................................................363
justify ...........................................................................................................................................................................364
list names.....................................................................................................................................................................364
merge ...........................................................................................................................................................................364
navigate arrow............................................................................................................................................................ 365
parse.............................................................................................................................................................................365
paste special ................................................................................................................................................................366
print out (table)...........................................................................................................................................................367
print preview (table) .................................................................................................................................................. 367
remove subtotal .......................................................................................................................................................... 368
replace..........................................................................................................................................................................368
row differences ...........................................................................................................................................................369
run VB macro (table).................................................................................................................................................. 369
set XML value .............................................................................................................................................................370
show (table)................................................................................................................................................................. 370
show dependents........................................................................................................................................................ 370
show errors.................................................................................................................................................................. 371
show precedents.........................................................................................................................................................371
sort................................................................................................................................................................................ 371
sort special...................................................................................................................................................................373
special cells.................................................................................................................................................................. 374
subtotal ........................................................................................................................................................................375
text to columns............................................................................................................................................................ 375
ungroup .......................................................................................................................................................................377
unmerge.......................................................................................................................................................................378
Proofing Suite Classes
autocorrect................................................................................................................................................................... 379
Proofing Suite Commands
add replacement.........................................................................................................................................................380
delete replacement .....................................................................................................................................................380
get replacement list .................................................................................................................................................... 380
Chart Suite Classes
area group ...................................................................................................................................................................382
axis................................................................................................................................................................................ 382
axis title........................................................................................................................................................................ 388
bar group ..................................................................................................................................................................... 390
Using the Excel Dictionary
11
chart..............................................................................................................................................................................390
chart area .....................................................................................................................................................................396
chart fill format...........................................................................................................................................................397
chart group.................................................................................................................................................................. 401
chart object ..................................................................................................................................................................404
chart title...................................................................................................................................................................... 406
column group..............................................................................................................................................................409
corners..........................................................................................................................................................................409
data label ..................................................................................................................................................................... 409
data table .....................................................................................................................................................................412
display unit label........................................................................................................................................................413
doughnut group .........................................................................................................................................................415
down bars.................................................................................................................................................................... 416
drop lines.....................................................................................................................................................................416
error bars .....................................................................................................................................................................417
floor ..............................................................................................................................................................................417
gridlines....................................................................................................................................................................... 418
hilo lines.......................................................................................................................................................................419
interior .........................................................................................................................................................................419
leader lines ..................................................................................................................................................................421
legend...........................................................................................................................................................................421
legend entry ................................................................................................................................................................422
legend key ................................................................................................................................................................... 423
line group .................................................................................................................................................................... 426
pie group .....................................................................................................................................................................427
plot area ....................................................................................................................................................................... 427
radar group .................................................................................................................................................................429
series.............................................................................................................................................................................429
series lines ...................................................................................................................................................................435
series point ..................................................................................................................................................................436
tick labels.....................................................................................................................................................................438
trendline ......................................................................................................................................................................440
up bars .........................................................................................................................................................................441
walls .............................................................................................................................................................................442
xy group....................................................................................................................................................................... 443
Chart Suite Commands
activate object (chart) ................................................................................................................................................. 444
apply custom chart type ............................................................................................................................................ 445
apply data labels......................................................................................................................................................... 445
bring to front (chart)...................................................................................................................................................445
chart location............................................................................................................................................................... 446
chart one color gradient.............................................................................................................................................446
chart patterned............................................................................................................................................................447
chart solid....................................................................................................................................................................448
chart two color gradient ............................................................................................................................................448
chart user picture........................................................................................................................................................449
chart user textured .....................................................................................................................................................449
chart wizard ................................................................................................................................................................ 449
check spelling (chart) ................................................................................................................................................. 450
clear ..............................................................................................................................................................................450
clear contents (chart)..................................................................................................................................................450
clear formats................................................................................................................................................................ 451
copy chart as picture..................................................................................................................................................451
Using the Excel Dictionary
12
copy object (chart) ......................................................................................................................................................451
copy picture (chart) ....................................................................................................................................................452
cut (chart)..................................................................................................................................................................... 452
deselect ........................................................................................................................................................................ 452
error bar....................................................................................................................................................................... 453
get axis ......................................................................................................................................................................... 453
get chart element ........................................................................................................................................................453
get has axis ..................................................................................................................................................................455
paste ............................................................................................................................................................................. 455
paste chart ...................................................................................................................................................................456
paste series ..................................................................................................................................................................456
preset chart gradient.................................................................................................................................................. 457
preset chart textured ..................................................................................................................................................458
print out (chart) .......................................................................................................................................................... 458
print preview (chart)..................................................................................................................................................458
protect chart ................................................................................................................................................................ 459
refresh (chart).............................................................................................................................................................. 459
save as (chart).............................................................................................................................................................. 460
send to back (chart) ....................................................................................................................................................461
set background picture (chart).................................................................................................................................. 461
set has axis................................................................................................................................................................... 461
set source data.............................................................................................................................................................462
unprotect (chart)......................................................................................................................................................... 462
Using the Excel Dictionary
13
Using the Excel Dictionary
About the Excel AppleScript Dictionary ...................................................................................................................13
Activating a workbook ................................................................................................................................................14
Creating a new workbook...........................................................................................................................................14
Opening a workbook ...................................................................................................................................................14
Referring to sheets by name........................................................................................................................................ 14
Referring to sheets by index number.........................................................................................................................15
How to reference cells and ranges .............................................................................................................................15
Selecting and activating cells ......................................................................................................................................18
Working with the active cell .......................................................................................................................................19
About the Excel AppleScript Dictionary
The Microsoft Excel AppleScript dictionary provides comprehensive access for programmatically
controlling Excel by using AppleScript. The Excel AppleScript Dictionary is based on the Visual
Basic object model for Excel, and as such its terminology and syntax closely mirror the terminology
and syntax used in Visual Basic. As a result of this close relationship with Visual Basic, the Excel
AppleScript Dictionary might appear more complex, and less "English-like" than other AppleScript
Dictionaries.
Using classes and commands
Classes and commands in the Excel AppleScript Dictionary often have many properties and
parameters. Many of these properties and parameters are represented by enumerations — or lists
of — constants rather than text or numbers or Boolean operators. These enumerations use many of
the same words as their parameters or properties and are usually descriptive of what they
represent. Because of the nature of the AppleScript language and the complexity of the underlying
object model, expressions containing several properties and parameters can be very long and often
look confusing. In such cases, it is helpful to use parentheses to separate out one property from
another to make your scripts easier to read. Additionally, you will find that the Excel object model is
very deep, requiring several layers to access certain objects. You might find it helpful to use
variables to store these objects and reduce the complexity of your script.
As in other applications, optional command parameters are denoted in the dictionary by [square
brackets]. Class properties always have default values, which means that when you create new
objects it is not necessary to supply values for all of the properties. Properties denoted by [r/o] are
read-only and cannot be set once an object exists. However, when you use the
make command to
create new objects, most read-only properties can be set by using the
with properties clause. For
more information about the properties available for various objects, see the object's entry in the
Dictionary Reference portion of this guide.
Using the Excel Dictionary
14
Activating a workbook
Activating a workbook using the activate object command puts the workbook in the active
window. The following procedure activates the open workbook named "MyBook.xls."
tell application "Microsoft Excel"
activate
activate object workbook "MyBook.xls"
end tell
Note The activate object command works only if Excel is the active program. When you use the
activate object command, you should also use the activate command to ensure that Excel is the
active program.
Creating a new workbook
To create a new workbook, you use the make command. The following procedure creates a new
workbook. Microsoft Excel automatically names the workbook SheetN, where N is the next
available number. The new workbook becomes the active workbook.
make new workbook
A better way to create a new workbook is to assign it to a variable. In the following example, the
workbook object returned by the make command is assigned to the variable
newBook. Next, several
properties of
newBook are set. You can easily control the new workbook using the object variable.
set newBook to make new workbook
set update remote references of newBook to true
save workbook as newBook filename "95Sales.xls"
Opening a workbook
You can open a workbook by using the open workbook command. The following procedure opens
a workbook named MyBook.xls.
open workbook workbook file name "Macintosh HD:Users:Shared:MyBook.xls"
Note It is recommended that you use the open workbook command (Microsoft Excel Suite) rather
than the open command (Standard Suite) to open a workbook in Excel. In addition to returning a
workbook object to which you can assign a variable, the open workbook command provides
several optional parameters you can set when opening the workbook. If you want to open multiple
workbooks at once, use the open command.
Referring to sheets by name
You can identify sheets by name by using the worksheet and chart classes. The following
statements activate various sheets in the active workbook.
activate object worksheet "Sheet1"
activate object chart object "Chart 1" of sheet 1
You can use the sheet class to return a worksheet or chart. The following example activates the sheet
named "Chart1" in the active workbook.
activate object sheet "Chart1"
Using the Excel Dictionary
15
Note Charts embedded in a worksheet belong to the chart object class, while charts that exist on
their own sheets belong to the chart class.
Referring to sheets by index number
An index number is a sequential number assigned to a sheet, based on the position of its sheet tab
(counting from the left) among sheets of the same type. The following procedure uses the
worksheet class to activate worksheet one in the active workbook.
activate object worksheet 1
If you want to work with all types of sheets (worksheets, charts, modules, and dialog sheets), use
the sheet class. The following procedure activates sheet four in the workbook.
activate object sheet 4
Note The index order can change if you move, add, or delete sheets.
How to reference cells and ranges
A common task when you are creating a script is to specify a cell or range of cells and then do
something with it, such as enter a formula or change the format. You can usually do this in one
statement that identifies the range and also changes a property or applies a command.
A range object can be either a single cell or a range of cells. The following topics show the most
common ways to identify and work with range objects.
Referring to cells and ranges using A1 notation
You can refer to a cell or range of cells in the A1 reference style by using the range class. The
following procedure changes the format of cells A1:D5 to bold.
set theRange to range "A1:D5" of sheet 1 of active workbook
set bold of font object of theRange to true
The following table illustrates some A1-style references using the range class.
Reference Meaning
range "A1"
Cell A1
range "A1:B5"
Cells A1 through B5
range "C5:D9,G9:H16"
A multiple-area selection
range "A:A"
Column A
range "1:1"
Row one
range "A:C"
Columns A through C
range "1:5"
Rows one through five
range "1:1,3:3,8:8"
Rows one, three, and eight
range "A:A,C:C,F:F"
Columns A, C, and F
Using the Excel Dictionary
16
You can also use absolute references with the range class. When you return a cell reference from
Excel, the reference is returned as an absolute reference. The following table illustrates absolute cell
references.
Reference Meaning
range "$A$1"
Cell A1
range "$A$1:$B$5"
Cells A1 through B5
For more information about the difference between relative and absolute cell references, see "About
cell and range references" in Excel Help.
Referring to cells using index numbers
You can use the cell class to refer to a single cell by using row and column index numbers. This
class inherits properties from a range object and represents a single cell. In the following example,
cell 6 of column 1 returns cell A6 on Sheet1. The value property is then set to 10.
set value of cell 6 of column 1 of active sheet to 10
Referring to rows and columns
To work with entire rows or columns, use the row class or the column class. These classes inherit
properties from the range class. In the following example,
row 1 of worksheet "sheet 1"
returns row one on Sheet1. The bold property of the font object for the row is then set to true.
set bold of font object of (row 1 of worksheet "sheet1") to true
The following table illustrates some row and column references using the row and column classes.
Reference Meaning
row 1
Row one
rows
All the rows on the worksheet
column 1
Column one
column "A"
Column one
columns
All the columns on the worksheet
To work with several rows or columns at the same time, create an object variable and use the union
command, combining multiple calls to the row or column class. The following example changes the
format of rows one, three, and five on worksheet one in the active workbook to bold.
set mySheet to worksheet "Sheet1" of active workbook
set myUnion to union range1 (row 1 of mySheet) range2 (row 3 of mySheet) ¬
range3 (row 5 of mySheet)
set bold of font object of myUnion to true
Using the Excel Dictionary
17
Referring to named ranges
Ranges are easier to identify by name than by A1 notation. To name a selected range, click the name
box at the left end of the formula bar, type a name, and then press ENTER.
Referring to a named range
The following example refers to the range named "MyRange" in the workbook named "MyBook.xls."
set italic of font object of range "MyBook.xls!MyRange" to true
The following example places a border around the worksheet-specific range named "Sheet1!Sales" in
the workbook named "Report.xls."
border around (range "[Report.xls]Sheet1!Sales") weight border weight thin
To select a named range, use the goto command, which activates the workbook and the worksheet
and then selects the range.
goto reference (range "MyBook.xls!MyRange")
clear contents selection
Referring to cells using a range object
If you set a variable to a range object, you can easily manipulate the range by using the variable
name.
The following procedure creates the variable
myRange and then assigns the variable to range A1:D5
on Sheet1 in the active workbook. Subsequent statements modify properties of the range by
substituting the variable name for the range object.
set myRange to range "A1:D5" of worksheet "Sheet1"
set formula of myRange to "=RAND()"
set bold of font object of myRange to true
Referring to multiple ranges
Using the appropriate command, you can easily refer to multiple ranges. To refer to any group of
ranges, use the range class and union command.
Using the range class
You can refer to multiple ranges with the range class by putting commas between two or more
references. The following example clears the contents of three ranges on Sheet1.
clear contents range "C5:D9, G9:H16, B14:D18" of sheet 1 of active workbook
Named ranges make using the range class to work with multiple ranges easier. The following
example works when all three named ranges are on the same sheet.
clear contents (range "MyRange, YourRange, TheRange")
Using the Excel Dictionary
18
Using the union command
You can combine multiple ranges into one range object using the union command. The following
example creates a range object named
myMultipleRange, defines it as the ranges A1:B2 and C3:D4,
and then formats the combined ranges as bold.
set r1 to range "A1:B2" of sheet "Sheet1"
set r2 to range "C3:D4" of sheet "Sheet1"
set myMultipleRange to union range1 r1 range2 r2
set bold of font object of myMultipleRange to true
Selecting and activating cells
When you work with Microsoft Excel, you usually select a cell or cells and then perform an action,
such as formatting the cells or entering values in them. When you are writing a script, it is usually
not necessary to select cells before modifying them.
For example, if you want to enter a formula in cell D6, you don't need to select the range D6. You
just need to return the range object and then set the formula property to the formula you want, as
shown in the following example.
set formula of range "D6" of worksheet "Sheet1" to "=SUM(D2:D5)"
For examples of using other commands to control cells without selecting them, see the topic on
"How to reference cells and ranges."
Using the select command and the selection property
The select command activates sheets and objects on sheets; the selection property returns an object
that represents the current selection on the active sheet in the active workbook. Before you can use
the selection property successfully, you must activate a workbook, activate or select a sheet, and then
select a range (or other object) by using the select command.
Activating a cell within a selection
You can use the activate object command to activate a cell within a selection. There can be only one
active cell, even when a range of cells is selected. The following procedure selects a range and then
activates a cell within the range without changing the selection.
activate object worksheet "Sheet1"
select (range "A1:D4")
activate object (range "B2")
Using the Excel Dictionary
19
Working with the active cell
The active cell property returns a cell object that represents the cell that is active. You can apply any
of the properties or commands of a range object to the active cell, as in the following example.
activate
activate object worksheet "Sheet1"
set value of active cell to 35
Note You can work with the active cell only when the worksheet that it is on is the active sheet.
Moving the active cell
You can use the activate object command to designate which cell is the active cell. For example, the
following procedure makes B5 the active cell and then formats it as bold.
activate object worksheet "Sheet1"
activate object range "B5" of worksheet "Sheet1"
set bold of font object of active cell to true
Note To select a range of cells, use the select command. To make a single cell the active cell, use the
activate object command.
Selecting the cells surrounding the active cell
The current region property returns a range of cells bounded by blank rows and columns. In the
following example, the selection is expanded to include the cells adjoining the active cell that
contain data.
activate object worksheet "Sheet1"
select current region of active cell
Microsoft Office Suite
21
Microsoft Office Suite
Microsoft Office Suite Classes.....................................................................................................................................21
Microsoft Office Suite Commands.............................................................................................................................43
Microsoft Office Suite Classes
assistant .........................................................................................................................................................................21
balloon checkbox..........................................................................................................................................................24
balloon ...........................................................................................................................................................................25
balloon label..................................................................................................................................................................29
command bar ................................................................................................................................................................ 29
command bar button....................................................................................................................................................33
command bar combobox.............................................................................................................................................34
command bar control...................................................................................................................................................36
command bar popup....................................................................................................................................................39
custom document property.........................................................................................................................................39
document property ......................................................................................................................................................39
web page font................................................................................................................................................................41
Class: assistant
Plural
assistants
Elements
balloon
Represents the Microsoft Office Assistant.
Use the office assistant property of the application class to return the assistant. Only one assistant
object can be active at a time. Use the visible property to display the Assistant.
By default, the Office Assistant is off. The default Assistant is Max. To select a different Assistant
programatically, use the file name property.
The following example turns on, displays, and animates the Assistant.
set assistant on of office assistant to true
set visible of office assistant to true
set animation of office assistant to greeting
Microsoft Office Suite
22
Properties
animation
Returns or sets an animation action for the Office Assistant. When this property is applied to
the assistant object, the Assistant is animated immediately (if it is visible). When this property
is applied to the balloon object, the Assistant is animated only while the balloon is displayed.
Can be one of the following constants:
appear
begin speaking
character success major
checking something
disappear
empty trash
gesture down
gesture left
gesture right
gesture up
get artsy
get attention major
get attention minor
get techy
get wizardy
goodbye
greeting
idle
listens to computer
look down
look down left
look down right
look left
look right
look up
look up left
look up right
printing
saving
searching
sending mail
thinking
working at something
writing noting something
assist with help
True if the Office Assistant appears when the user presses the HELP key to display Help.
Read/write.
If this property is set to False, the Help window appears instead of the Office Assistant.
This property corresponds to the Respond to HELP key option (Office Assistant dialog box,
Options tab).
assist with wizards
True if the Office Assistant provides online Help with wizards. Read/write.
This property corresponds to the Help with wizards option (Office Assistant dialog box,
Options tab).
assistant item
Returns the text associated with the Office Assistant. Read-only.
assistant on
True if the Office Assistant is enabled. Read/write.
Microsoft Office Suite
23
balloon error
Returns a value that indicates the last recorded balloon error. Read-only.
Can be one of the following:
bad picture
reference
The balloon contains a graphic that couldn't be displayed because the file
doesn't exist or because the graphic isn't a valid PICT file.
bad reference
The balloon contains an unrecognized or unsupported reference.
buttonless
modal
The balloon you attempted to display is modal, but it contains no buttons. The
balloon won't be shown because it can't be dismissed.
button
modeless
The balloon you attempted to display is modeless, contains no buttons, and
has no procedure assigned to the callback property. The balloon won't be
shown because a callback procedure is required for modeless balloons.
none
No error was encountered.
bad character
The balloon contains an ASCII control character other than CR or LF and
greater than 32.
out of
memory
The balloon won't appear because there is insufficient memory.
too big
The balloon is too big to appear on the screen.
other
The balloon won't appear because some other error occurred; for example,
another modal balloon is already active.
feature tips
True if the Office Assistant provides information about using application features more
effectively. Read/write.
This property corresponds to the Using features more effectively option (Office Assistant
dialog box, Options tab).
file name
Returns or sets the name of the file for the active Office Assistant. Read/write.
The Office Assistant files are installed in the Microsoft Office 2004/Office/Assistants folder.
keyboard shortcut tips
True if the Office Assistant displays Help about keyboard shortcuts. Read/write.
This property corresponds to the Keyboard shortcuts option (Office Assistant dialog box,
Options tab).
left position
Returns the horizontal position of the Office Assistant window (in points) relative to the
screen.
Microsoft Office Suite
24
mouse tips
True if the Office Assistant provides suggestions for using the mouse effectively. Read/write.
This property corresponds to the Using the mouse more effectively option (Office Assistant
dialog box, Options tab).
move when in the way
True if the Office Assistant window automatically moves when it's in the way of the user's
work area. For example, the Office Assistant will move if it's in the way of dragging or
dropping or in the way of keystroke entries. Read/write.
This property corresponds to the Move when in the way option (Office Assistant dialog box,
Options tab).
name
Returns the name of the Office Assistant currently in use. Read-only.
sounds
True if the Office Assistant produces the sounds that correspond to animations. Read/write.
If a sound card is not installed, this property has no effect.
tip of the day
True if the Office Assistant displays a special tip each time the Office application is opened.
Read/write.
This property corresponds to the Show the Tip of the Day at startup option (Office Assistant
dialog box, Options tab).
top
Returns the vertical position of the Office Assistant window (in points) relative to the screen..
visible
True if the Office Assistant is visible. Read-write.
Class: balloon checkbox
Represents a check box in the Office Assistant balloon.
Use balloon checkbox index, where index is a number from 1 through 5, to return a single balloon
checkbox object. There can be up to five check boxes in one balloon; each check box appears when a
value is assigned to its checkbox text property.
Remarks
Balloon check boxes display the user's choices until the user dismisses the balloon. To record the
user's choice as soon as the user clicks the button beside the label, see the topic on balloon labels.
Microsoft Office Suite
25
Properties
balloon checkbox item
Returns the text associated with the balloon check box. Read-only.
checkbox text
Returns or sets the text displayed next to a check box in the Office Assistant balloon.
Read/write.
checked
True if the specified check box in the Office Assistant balloon is checked. Read/write.
name
Returns the name of the check box label. Read-only.
Class: balloon
Plural
balloons
Elements
balloon checkbox
balloon label
Represents the balloon in which the Office Assistant displays information. A balloon can contain
controls such as check boxes and labels.
Only one balloon can be visible at a time. However, it's possible to define several balloons and
display any one of them when needed. For more information, see "Defining and Reusing Balloons"
later in this topic.
To make the specified balloon visible, use the show balloon
command. Use the call back property to
run procedures based on selections from modeless balloons (balloons that remain visible while a
user works in the application).
The following example creates a balloon that contains tips for saving entered data.
set newbal to make new balloon of office assistant
set balloon type of newbal to bullets
set icon of newbal to icon tip
set balloon button of newbal to buttons ok cancel
set heading of newbal to "Tips for Saving Information."
repeat 3 times
make new balloon label at the beginning of newbal
end repeat
set label text of balloon label 1 of newbal to "Save your work often."
set label text of balloon label 2 of newbal to "Install a surge protector."
set label text of balloon label 3 of newbal to "Exit your application properly."
show balloon newbal
Microsoft Office Suite
26
Defining and Reusing Balloons
You can reuse balloon objects you've already created by assigning the object to a variable and
displaying the variable when you need it. This example defines
balloon1, balloon2, and balloon3
separately so they can be reused.
set balloon1 to make new balloon of office assistant
set heading of balloon1 to "First balloon"
Set balloon2 to make new balloon of office assistant
set heading of balloon2 to "Second balloon"
Set balloon3 to make new balloon of office assistant
set heading of balloon3 to "Third balloon"
show balloon balloon1
show balloon balloon3
show balloon balloon2
Alternatively, instead of using separate variables, you can place the balloon object into an array.
Properties
balloon button
Returns or sets the type of button displayed at the bottom of the Office Assistant balloon.
When you create a new balloon, this property is initially set to OK. Read/write.
Can be one of the following:
buttons abort retry ignore
buttons back close
buttons back next close
buttons back next snooze
button cancel
buttons next close
button none
button ok
buttons ok cancel
buttons retry cancel
buttons search close
buttons tips options close
buttons yes all no cancel
buttons yes no cancel
buttons yes no
Microsoft Office Suite
27
balloon mode
Returns or sets the type of balloon displayed. Read/write.
Can be one of the following:
auto down balloon - Balloon is instantly dismissed when the user clicks anywhere
on the screen.
modal balloon - This is the initial default setting. User must dismiss the balloon
before he or she can return to working in the application.
modeless balloon - User can work in the application while the balloon is visible.
When this value is used, a value for the call back callback property is also required.
When you create a new balloon, this property is initially set to modal balloon.
balloon text
Returns or sets the text displayed after the heading but before the labels or check boxes in the
Office Assistant balloon. Read/write.
You can specify a graphic to display by using the following syntax:
{type location sizing_factor},
where
type is pict (Macintosh PICT file).
location is the resource id or the path and file name.
sizing_factor specifies the width of the pict.
balloon type
Returns or sets the type of balloon the Office Assistant uses. Read/write.
Can be one of the following:
buttons - This is the initial default setting.
bullets
numbers
Microsoft Office Suite
28
call back
Sets the name of the procedure to run from a modeless balloon. Read/write String.
The procedure you specify for the call back property must be written to receive three
arguments:
The balloon object that called the procedure
The value of the button the user clicked
An integer that uniquely identifies the balloon that called the procedure
heading
Returns or sets the heading that appears in the Office Assistant balloon. Read/write.
You can specify a graphic to display in the balloon heading by using the following syntax:
{type location sizing_factor}
where
type is pict (Macintosh PICT file).
location is the resource id or the path and file name
sizing_factor specifies the width of the pict.
icon
Returns or sets the type of icon that appears in the upper-left portion of the Office Assistant
balloon. Read/write.
Can be one of the following:
icon alert
icon alert critical
icon alert info
icon alert warning
icon application
icon none
icon tip
name
Returns the name of the balloon. Read-only.
Microsoft Office Suite
29
Class: balloon label
Represents a label in the Office Assistant balloon.
Use balloon label index, where index is a number from 1 through 5, to return a balloon label object.
There can be up to five labels on one balloon; each label appears when a value is assigned to its label
text property.
Remarks
Balloon labels record the user's choice as soon as the user clicks the button beside the label. To
display the user's choices until the user dismisses the balloon, see the topic on balloon check boxes.
Properties
balloon label item
Returns the text associated with the balloon label. Read-only.
label text
Returns or sets the text displayed next to a label in the Office Assistant balloon. Read/write.
Remarks
You can specify a graphic to display by using the following syntax:
{type location sizing_factor},
where
type is pict (Macintosh PICT file)
location is the resource id or the path and file name
and sizing_factor specifies the width of the pict
name
Returns the name of the balloon label. Read-only.
Class: command bar
Plural
command bars
Elements
command bar control
Represents a command bar in an Office application.
Microsoft Office Suite
30
Use command bar index, where index is the name or index number of a command bar, to return a
command bar object. The following example steps through the collection of command bars to find
the command bar named "Forms." If it finds this command bar, the example makes it visible and
protects its docking state. In this example, the variable
bars represents the list of all command bars,
and the variable
cb represents a command bar object.
set foundFlag to false
set bars to command bars
repeat with cb in bars
repeat 1 times
if name of cb is "Forms" then
set protection of cb to no change dock
set visible of cb to true
set foundFlag to true
end if
exit repeat
set end of bars to cb
end repeat
end repeat
if foundFlag is false then
display dialog "There is no Forms command bar."
end if
You can use a name or index number to specify a menu bar or toolbar in the list of available menu
bars and toolbars in the Office application. However, you must use a name to specify a menu,
shortcut menu, or submenu (all of which are represented by command bar objects). This example
adds a new menu item to the bottom of the Tools menu. When a user clicks the new menu item, it
runs the procedure named "qtrReport."
set newItem to make new command bar button at command bar "Tools"
set begin group of newItem to True
set caption of newItem to "Make Report"
set face id of newItem to 0
set OnAction of newItem to "qtrReport"
If two or more custom menus or submenus have the same name, command bar index returns the
first one.
Microsoft Office Suite
31
Properties
bar position
Returns or sets the position of a command bar. Read/write.
Can be one of the following:
bar left
bar top
bar right
bar bottom
bar floating
bar pop up
bar menu
bar type
Returns the type of command bar. Read-only.
Can be one of the following:
normal command bar
menubar command bar
popup command bar
built in
True if the specified command bar or command bar control is a built-in command bar or
control of the container application. False if it's a custom command bar or control. Read-only.
context
Returns or sets a string that determines where a command bar will be saved. The string is
defined and interpreted by the application. Read/write.
You can set the context property only for custom command bars. This property will fail if the
application doesn't recognize the context string, or if the application doesn't support changing
context strings programmatically.
enabled
True if the specified command bar or command bar control is enabled. Read/write.
For command bars, setting this property to True causes the name of the command bar to
appear in the list of available command bars.
For built-in controls, setting this property to True causes the application to determine the state
of the control. Setting this property to False forces the control to be disabled.
Microsoft Office Suite
32
entry index
Returns the index number for a command bar. Read-only.
The position of the first command bar control is 1. Separators are not counted.
height
Returns or sets the height (in pixels) of a command bar or command bar control. Read/write.
An error will occur if you attempt to set the height property for a command bar that isn't in a
resizable state (that is, if it's docked or protected from resizing).
left position
Returns or sets the distance (in pixels) from the left edge of the specified command bar or
command bar control to the left edge of the screen. Returns the distance from the left side of
the docking area. Read/write.
local name
Returns the name of a built-in command bar as it's displayed in the language version of the
container application, or returns or sets the name of a custom command bar. Read/write.
Note If you attempt to set this property for a built-in command bar, an error occurs.
The local name of a built-in command bar is displayed in the title bar (when the command bar
isn't docked) and in the list of available command bars, wherever that list is displayed in the
container application.
If you change the value of the local name property for a custom command bar, the value of
name changes as well, and vice versa.
name
Returns or sets the name of the specified object. Read/write.
The local name of a built-in command bar is displayed in the title bar (when the command bar
isn't docked) and in the list of available command bars, wherever that list is displayed in the
container application.
For a built-in command bar, the name property returns the command bar's U.S. English name.
To return the localized name, use the local name property.
If you change the value of the name property for a custom command bar, the value of local
name changes as well, and vice versa.
Microsoft Office Suite
33
protection
Returns or sets the way a command bar is protected from user customization. Read/write.
Can be one of or a sum of the following:
no protection
no customize
no resize
no move
no change visible
no change dock
no vertical dock
no horizontal dock
row index
Returns or sets the docking order of a command bar in relation to other command bars in the
same docking area. Can be an integer greater than zero.
Several command bars can share the same row index, and command bars with lower numbers
are docked first. If two or more command bars share the same row index, the command bar
most recently assigned will be displayed first in its group.
top
Returns or sets the distance (in pixels) from the top edge of the specified command bar or
command bar control to the top edge of the screen. For docked command bars, this property
returns or sets the distance from the command bar to the top of the docking area. Read/write.
visible
True if a command bar or command bar control is visible. Read/write.
width
Returns or sets the width (in pixels) of the specified command bar or command bar control.
Read/write.
Class: command bar button
Plural
command bar buttons
Represents a button control on a command bar.
Use command bar control index, where index is the index number of the control, to return a
command bar button object. (The control type property of the control must be control button.)
Microsoft Office Suite
34
Properties
button face is default
True if the face of the specified command bar button control is its original built-in face. This
property can only be set to True, which will reset the face to the built-in face. Read/write.
button state
Returns or sets the appearance of a command bar button control. Can be one of the following
button state up
button state down
button state unset
button style
Returns or sets the way a command bar button control is displayed. Read/write.
Can be one of the following:
button automatic
button icon
button caption
button icon and caption
face id
Returns or sets the ID number for the face of a command bar button control. Read/write.
The face id property dictates the look, but not the function, of a command bar button. To
determine the function of the button, use the id property of the command bar control object.
The value of the face id property for a command bar button with a custom face is 0 (zero).
shortcut text
Returns or sets the shortcut key text displayed next to a button control when the button
appears on a menu, submenu, or shortcut menu. Read/write.
You can set this property only for command bar buttons that contain an on-action macro.
Class: command bar combobox
Plural
command bar comboboxes
Represents a combo box control on a command bar.
Use command bar control index, where index is the index number of the control, to return a
command bar combobox object. (The control type property of the control must be control edit,
control dropdown, control combobox, button dropdown, split dropdown, OCX dropdown,
graphic combo, or graphic dropdown.)
Microsoft Office Suite
35
The following example creates a new command bar combobox and adjusts the size of the control on
the command bar named "Custom," and then it adds two items to the combo box.
set newCombo to make new command bar control at command bar "Custom" with ¬
properties {control type:control combobox}
set drop down lines of newCombo to 3
set drop down width of newCombo to 90
set list index of newCombo to 0
add item to combobox newCombo combobox item "First Item" entry index 1
add item to combobox newCombo combobox item "Second Item" entry index 2
Properties
combobox style
Returns or sets the way a command bar combo box control is displayed. Read/write.
Can be either of the following:
combobox style label
combobox style normal
combobox text
Returns or sets the text in the display or edit portion of the command bar combo box control.
Read/write.
drop down lines
Returns or sets the number of lines in the specified command bar combo box control. The
combo box control must be a custom control, and it must be either a drop-down list box or a
combo box. Read/write.
Note If this property is set for a combo box control that's either an edit box or a built-in
combo box control, an error occurs.
If this property is set to 0 (zero), the number of lines in the control will be based on the number
of items in the list.
drop down width
Returns or sets the width (in pixels) of the list for the specified command bar combo box
control. Read/write.
Note An error occurs if you attempt to set this property for a built-in control.
If this property is set to -1, the width of the list is based on the length of the longest item in the
combo box list. If this property is set to 0, the width of the list is based on the width of the
control.
list index
Returns or sets the index number of the selected item in the list portion of the command bar
combo box control. If nothing is selected in the list, this property returns zero. Read/write.
Note This property fails when applied to controls other than list controls.
Setting the list index property causes the specified control to select the given item and execute
the appropriate action in the application.
Microsoft Office Suite
36
Class: command bar control
Plural
command bar controls
Represents a command bar control. The properties and commands of the command bar control
object are all shared by the command bar button, command bar combobox, and command bar
popup classes.
Note To write scripts to work with custom command bar controls, use the command bar button,
command bar combobox, and command bar popup classes. To write scripts to work with built-in
controls in the container application that cannot be represented by one of those three classes, use the
command bar control class.
Use command bar control index, where index is the index number of a control, to return a command
bar control object. (The control type property of the control must be control label, expanding grid,
split expanding grid, control grid, or control gauge.)
Note Variables declared as command bar control can be assigned command bar button, command
bar combobox, and command bar popup values.
Properties
begin group
True if the specified command bar control appears at the beginning of a group of controls on
the command bar. Read/write.
built in
True if the specified command bar or command bar control is a built-in command bar or
control of the container application. False if it's a custom command bar or control, or if it's a
built-in control whose on action property has been set. Read-only.
control type
Returns the type of command bar control. Read-only.
Can be one of the following:
control button
button drop down
button popup
control combobox
control custom
control dropdown
control edit
expanding grid
control gauge
generic dropdown
graphic combo
graphic popup
graphic dropdown
control grid
control label
OCX dropdown
msopopup
split button MRU popup
split button popup
split dropdown
split expanding grid
Microsoft Office Suite
37
description text
Returns or sets the description for the specified command bar control. The description is
displayed in the status bar of the container application when the user positions the pointer
over a command bar control. Read/write.
Not all applications display a status bar.
enabled
True if the specified command bar or command bar control is enabled. Read/write.
For command bars, setting this property to True causes the name of the command bar to
appear in the list of available command bars.
For built-in controls, if you set the enabled property to True, the application determines its
state. Setting the enabled property to False forces the control to be disabled.
entry index
Returns the index number for the command bar control. Read-only.
height
Returns or sets the height (in pixels) of a command bar or command bar control. Read/write.
An error will occur if you attempt to set the height property for a command bar that isn't in a
resizable state (that is, if it's docked or protected from resizing).
help context ID
Returns or sets the Help context Id number for the Help topic attached to the command bar
control. Read/write.
To use this property, you must also set the help file property.
help file
Returns or sets the Help file name for the Help topic attached to the command bar control.
Read/write.
To use this property, you must also set the help context ID property.
id
Returns the ID for a built-in command bar control. Read-only.
A control's ID determines the built-in action for that control. The value of the id property for all
custom controls is 1.
Microsoft Office Suite
38
left position
Returns the distance (in pixels) from the left edge of the specified command bar or command
bar control to the left edge of the screen. Returns the distance from the left side of the docking
area. Read-only.
name
Returns or sets the caption text for a command bar control. Read/write.
on action
Returns or sets the name of a Visual Basic procedure that will run when the user clicks or
changes the value of a command bar control. Read/write.
parameter
Returns or sets a string that an application can use to execute a command. Read/write.
If the specified parameter is set for a built-in control, the application can modify its default
behavior if it can parse and use the new value. If the parameter is set for custom controls, it
can be used to send information to Visual Basic procedures, or it can be used to hold
information about the control (similar to a second tag property value).
priority
Returns or sets the priority of a command bar control. A control's priority determines whether
the control can be dropped from a docked command bar if the command bar controls can't fit
in a single row. Read/write.
Valid priority numbers are 0 (zero) through 7. Special priority numbers are 0 and 1. A priority
of 0 indicates an "automatic" value, which means a number is assigned based on the type of
control. A priority of 1 means the control cannot be dropped.
tag
Returns or sets information about the command bar control, such as data that can be used as
an argument in procedures, or information that identifies the control. Read/write.
tooltip text
Returns or sets the text displayed in a command bar control's ScreenTip. Read/write.
top
Returns or sets the distance (in pixels) from the top edge of the specified command bar or
command bar control to the top edge of the screen. For docked command bars, this property
returns or sets the distance from the command bar to the top of the docking area. Read-only.
Microsoft Office Suite
39
visible
True if a command bar or command bar control is visible. Read/write.
width
Returns or sets the width (in pixels) of the specified command bar or command bar control.
Read/write.
Class: command bar popup
Plural
command bar popups
Elements
command bar control
Represents a pop-up control on a command bar.
Use command bar control index, where index is the number of the control, to return a command bar
popup object. (The control type property of the control must be control popup, graphic popup,
button popup, split button popup, or split button MRU popup.)
Class: custom document property
Plural
custom document properties
Represents a custom document property of a container document.
Use custom document property index, where index is the name or index number of the custom
document property, to return a custom document property object that represents a specific custom
document property.
Class: document property
Plural
document properties
Represents a built-in document property of a container document.
Use document property index, where index is the name or index number of the built-in document
property, to return a single document property object that represents a specific built-in document
property.
Microsoft Office Suite
40
The names of all the available built-in document properties are shown on the following list:
Title
Subject
Author
Keywords
Comments
Template
Last Author
Revision Number
Application Name
Last Print Date
Creation Date
Last Save Time
Total Editing Time
Number of Pages
Number of Words
Number of Characters
Security
Category
Format
Manager
Company
Number of Bytes
Number of Lines
Number of Paragraphs
Number of Slides
Number of Notes
Number of Hidden Slides
Number of Multimedia Clips
Container applications don't necessarily define a value for every built-in document property. If a
given application doesn't define a value for one of the built-in document properties, returning the
value property for that document property causes an error.
Properties
document property type
Returns or sets the document property type. Read-only for built-in document properties;
read/write for custom document properties.
Can be one of the following:
boolean
date
float
number
string
link source
Returns or sets the source of a linked custom document property. Read/write.
This property applies only to custom document properties; you cannot use it with built-in
document properties.
The source of the specified link is defined by the container application.
Setting the link source property sets the link to context property to True.
Microsoft Office Suite
41
link to context
True if the value of the custom document property is linked to the content of the container
document. False if the value is static. Read/write.
This property applies only to custom document properties. For built-in document properties,
the value of this property is False.
Use the link source property to set the source for the specified linked property. Setting the link
source property sets the link to context property to True.
name
Returns the name of the specified object. Read-only.
value
Returns or sets the value of a document property. Read/write.
If the container application doesn't define a value for one of the built-in document properties,
reading the value property for that document property causes an error.
Class: web page font
Represents the default font used when documents are saved as Web pages for a particular character
set.
Use the web page font object to describe the proportional font, proportional font size, fixed-width
font, and fixed-width font size for any available character set. The following character sets are
supported:
Arabic
Cyrillic
English Western European Other Latin
Script
Greek
Hebrew
Japanese
Korean
Multilingual
Unicode
Simplified Chinese
Thai
Traditional Chinese
Vietnamese
Properties
fixed width font
Sets or returns the fixed-width font setting in the host application. Read/write.
When you set the fixed width font property, the host application does not check the value for
validity.
Microsoft Office Suite
42
fixed width font size
Sets or returns the fixed-width font size setting in the host application, in points. Read/write.
When you set the fixed width font size property, the host application does not check the value
for validity. If you enter an invalid value, such as a nonnumber, the host application sets the
size to 0 points. You can enter half-point sizes; if you enter other fractional point sizes, they are
rounded up or down to the nearest half-point.
proportional font
Sets or returns the proportional font setting in the host application. Read/write.
When you set the proportional font property, the host application does not check the value for
validity.
proportional font size
Sets or returns the proportional font size setting (in points) in the host application. Read/write.
When you set the proportional font size property, the host application does not check the value
for validity. If you enter an invalid value, such as a nonnumber, the host application sets the
size to 0 points. You can enter half-point sizes; if you enter other fractional point sizes, they are
rounded up or down to the nearest half-point.
.
Microsoft Office Suite
43
Microsoft Office Suite Commands
add item to combobox .................................................................................................................................................43
clear combobox .............................................................................................................................................................43
execute ...........................................................................................................................................................................44
get combobox item .......................................................................................................................................................45
get count of combobox items ......................................................................................................................................45
remove an item from combobox.................................................................................................................................46
reset ................................................................................................................................................................................46
show balloon.................................................................................................................................................................47
Command: add item to combobox
Adds a list item to the specified command bar combo box control. The combo box control must be a
custom control, and it must be either a drop-down list box or a combo box.
Note This command will fail if it's applied to an edit box or a built-in combo box control.
Syntax
add item to combobox command bar combobox Required. An expression that returns a
command bar combobox object
combobox item Unicode text Required. The text to be added to the specified control.
[entry index small integer] Optional. The position of the specified item in the list. If this argument is
omitted, the item is added at the end of the list.
Example
This example adds a combo box control to a command bar. Two items are added to the control, and
the number of line items and the width of the combo box are set.
set myBar to make new command bar with properties ¬
{bar type:normal command bar, name:"New"}
set myControl to make new command bar control at myBa
with properties {control type:control combobox, combobox text:"Monday",¬
combobox style:combobox style label, drop down lines:2, drop down width:75}
add item to combobox myControl combobox item "Monday" entry index 1
add item to combobox myControl combobox item "Tuesday" entry index 2
Command: clear combobox
Removes all list items from the specified command bar combo box control (drop-down list box or
combo box) and clears the text box (edit box or combo box).
Note This command will fail if it's applied to a built-in command bar control.
Microsoft Office Suite
44
Syntax
clear combobox command bar combobox Required. An expression that returns a command bar
combobox object.
Example
This example checks the number of items in the combo box control named "Names" on the
command bar named "Custom." If there are more than three items in the list, the example clears the
list, adds a new first item to the list, and displays this new item as the default for the combo box
control.
set myBar to command bar "Custom"
set myControl to command bar control "Names" of myBar
set listItems to get count of combobox items myControl
if listitems > 3 then
clear combobox myControl
add item to combobox myControl combobox item "Third Item" entry index 1
set list index of myControl to 1
end if
Command: execute
Runs the procedure associated with a command bar control.
Syntax
execute command bar control Required. An expression that returns a command bar control,
command bar button, or command bar combobox object.
Remarks
This command runs the specified script or command if controls are currently enabled in the
application and if the enabled property of the specified object is True.
Applying this command to a command bar popup object generates a run-time error.
Example
This example checks the value of the combo box control on the custom command bar named "My
Custom Bar." If the index number of the command bar control is 1, the example runs the script
specified by the on action property of the command bar control.
set mycontrol to the first command bar combobox of command bar "My Custom Bar"
if entry index of myControl = 1 then
execute myControl
end if
Microsoft Office Suite
45
Command: get combobox item
Returns the string at the given index of items within a combo box control.
Syntax
get combobox item command bar combobox Required. An expression that returns a command
bar combobox object.
entry index small integer Required. The position of the specified item in the list. If this
argument is omitted, the last item in the list is returned.
Command: get count of combobox items
Returns the number of items within a combo box control.
Syntax
get count of combobox items command bar combobox Required. An expression that returns a
command bar combobox object.
Example
This example uses the get count of combobox items command to check the number of items in the
combo box control named "Names" on the command bar named "Custom." If there are more than
three items on the list, the example clears the list, adds a new first item to the list, and displays this
new item as the default for the combo box control.
set myBar to command bar "Custom"
set myControl to command bar control "Names" of myBar
set listItems to get count of combobox items myControl
if listitems > 3 then
clear combobox myControl
add item to combobox myControl combobox item "Third Item" entry index 1
set list index of myControl to 1
end if
Microsoft Office Suite
46
Command: remove an item from combobox
Removes an item from a command bar combo box control.
Note This command fails when applied to controls other than list controls.
Syntax
remove an item from combobox command bar combobox Required. An expression that returns a
command bar combobox object.
entry index small integer Required. The index number of the item to be removed from the list.
Example
The following example determines whether there are more than three items in a combo box control.
If there are more than three items, the example removes the second item, alters the style, and sets a
new value.
set myBar to command bar "Custom"
set myControl to command bar combobox 1 of myBar
set listitems to get count of combobox items myControl
if listitems > 3 then
remove an item from combobox myControl entry index 2
set combobox style of myControl to combobox style normal
set combobox text of myControl to "New Default"
end if
Command: reset
Resets a built-in command bar to its default configuration, or resets a built-in command bar control
to its original function and face.
Syntax
reset command bar/command bar control Required. An expression that returns a command bar,
command bar control, command bar button, command bar popup, or command bar combobox
object.
Remarks
Resetting a built-in control restores the actions originally intended for the control and resets each of
the control's properties back to its original state. Resetting a built-in command bar removes custom
controls and restores built-in controls.
Example
This example resets the Formatting toolbar to its default state
reset command bar "Formatting"
Microsoft Office Suite
47
Command: show balloon
Displays the specified balloon object. Returns a constant that indicates which balloon the user clicks.
Syntax
show balloon balloon Required. An expression that returns a balloon object.
Remarks
You can use the return value of the show balloon command to display a user's button selection. The
show balloon command returns one of the following buttons:
abort button
cancel button
ignore button
no button
OK button
retry button
snooze button
yes button
back button
close button
next button
null button
options button
search button
tips button
yes to all button
Example
This example creates a balloon that contains three choices
set b to make new balloon at office assistant
tell b
set heading to "This is my heading"
set balloon text to "Select one of these things"
repeat 3 times
make new balloon label at the beginning
end repeat
set label text of balloon label 1 to "Choice One"
set label text of balloon label 2 to "Choice Two"
set label text of balloon label 3 to "Choice Three"
show balloon
end tell
Microsoft Excel Suite
49
Microsoft Excel Suite
Microsoft Excel Suite Classes...................................................................................................................................... 49
Microsoft Excel Suite Commands ............................................................................................................................173
Microsoft Excel Suite Classes
add in .............................................................................................................................................................................50
application..................................................................................................................................................................... 51
autofilter ........................................................................................................................................................................64
border.............................................................................................................................................................................64
button.............................................................................................................................................................................66
calculated field..............................................................................................................................................................70
calculated item..............................................................................................................................................................70
chart sheet......................................................................................................................................................................71
checkbox ........................................................................................................................................................................72
child item.......................................................................................................................................................................74
column field ..................................................................................................................................................................75
custom view .................................................................................................................................................................. 75
data field........................................................................................................................................................................76
default web options......................................................................................................................................................76
dialog .............................................................................................................................................................................80
document.......................................................................................................................................................................80
dropdown......................................................................................................................................................................80
Excel comment..............................................................................................................................................................83
filter................................................................................................................................................................................ 83
format condition ...........................................................................................................................................................84
graphic ........................................................................................................................................................................... 86
groupbox ....................................................................................................................................................................... 88
hidden field ...................................................................................................................................................................90
hidden item ...................................................................................................................................................................91
horizontal page break ..................................................................................................................................................91
hyperlink .......................................................................................................................................................................92
international macro sheet............................................................................................................................................94
label ................................................................................................................................................................................ 94
list column.....................................................................................................................................................................96
list object........................................................................................................................................................................97
list row ...........................................................................................................................................................................99
listbox............................................................................................................................................................................. 99
macro sheet .................................................................................................................................................................102
named item..................................................................................................................................................................102
ODBC error .................................................................................................................................................................104
option button ..............................................................................................................................................................105
outline ..........................................................................................................................................................................107
page field..................................................................................................................................................................... 108
page setup ...................................................................................................................................................................109
pane.............................................................................................................................................................................. 115
parent item .................................................................................................................................................................. 115
phonetic ....................................................................................................................................................................... 116
pivot cache...................................................................................................................................................................117
pivot field ....................................................................................................................................................................119
Microsoft Excel Suite
50
pivot formula .............................................................................................................................................................. 124
pivot item ....................................................................................................................................................................125
pivot table....................................................................................................................................................................127
query table...................................................................................................................................................................132
recent file .....................................................................................................................................................................139
row field.......................................................................................................................................................................140
scenario........................................................................................................................................................................140
scrollbar .......................................................................................................................................................................141
sheet .............................................................................................................................................................................143
spinner .........................................................................................................................................................................147
textbox..........................................................................................................................................................................149
validation.....................................................................................................................................................................153
vertical page break ..................................................................................................................................................... 156
web options.................................................................................................................................................................157
window........................................................................................................................................................................160
workbook.....................................................................................................................................................................165
worksheet .................................................................................................................................................................... 171
Class: add in
Plural
add ins
Represents a single add-in, either installed or not installed. This list corresponds to the list of add-
ins displayed in the Add-Ins dialog box (Tools menu).
Use add in index, where index is the add-in title or index number, to return a single add in object.
The following example installs the Analysis Toolpak add-in.
set installed of add in "analysis toolpak" to true
Don't confuse the add-in title, which appears in the Add-Ins dialog box, with the add-in name,
which is the file name of the add-in. You must spell the add-in title exactly as it's spelled in the Add-
Ins dialog box, but the capitalization doesn't have to match.
The index number represents the position of the add-in in the Add-ins available box in the Add-Ins
dialog box. The following example creates a list that contains specified properties of the available
add-ins.
set theList to {"Name","Full Name","Path","Installed"}
set value of range "A1:D1" to theList
set bold of font object of range "A1:D1" to true
repeat with i from 1 to (get count of add ins)
set value of cell ("A" & (i + 1)) to (get name of add in i)
set value of cell ("B" & (i + 1)) to (get full name of add in i)
set value of cell ("C" & (i + 1)) to (get path of add in i)
set value of cell ("D" & (i + 1)) to (get installed of add in i)
end repeat
set wrap text of column "A:D" to true
Microsoft Excel Suite
51
To return a reference to the workbook corresponding to a loaded add-in, use workbook index,
where index is the add-in filename (not title). This example sets the
wb variable to the workbook for
Myaddin.xla.
set wb to workbook "Myaddin.xla"
If the installed property returns true, but calls to functions in the add-in still fail, the add-in may not
actually be loaded. This is because the add in object represents the existence and installed state of
the add-in but doesn't represent the actual contents of the add-in workbook. To guarantee that an
installed add-in is loaded, you should open the add-in workbook.
Properties
full name
Returns the name of the object, including its path on disk, as a string. Read-only.
This property is equivalent to the path property, followed by the current file system separator,
followed by the name property.
installed
True if the add-in is installed. Read/write.
Setting this property to true installs the add-in and calls its Auto_Add functions. Setting this
property to false removes the add-in and calls its Auto_Remove functions.
name
Returns or sets the name of the object. The name of a range object is a name object. For every
other type of object, the name is a string.
path
Returns the complete path of the object, excluding the final separator and name of the object.
Read-only.
Using this property without an object qualifier is equivalent to
get path of application
"microsoft excel" (this returns the path to the Microsoft Excel application).
Class: application
Plural
applications
Elements
add in
chart sheet
command bar
named item
range
cell
row
column
window
workbook
sheet
worksheet
international macro sheet
macro sheet
recent file
ODBC error
Represents the entire Excel application.
The application class contains application-wide settings and options — for example, many of the
options in the Preferences dialog box (Excel menu) — and properties that return top-level objects,
such as active cell, active sheet, and so on.
Microsoft Excel Suite
52
Properties
Excel cursor
Returns or sets the appearance of the mouse pointer in Excel. Read/write.
Can be one of the following.
Value Description
default cursor
The default pointer
wait cursor
The spinning color wheel
northwest arrow cursor
The northwest-arrow pointer
I beam cursor
The I-beam pointer
The Excel cursor property isn't reset automatically when the script stops running. You should
reset the pointer to default cursor before your script stops running.
ODBC timeout
Returns or sets the ODBC query time limit, in seconds. The default value is 45 seconds.
Read/write.
The value 0 (zero) indicates an indefinite time limit.
active cell
Returns a range object that represents the active cell in the active window (the window on
top). If the window isn't displaying a worksheet, this property fails. Read-only.
If you don't specify an object qualifier, this property returns the active cell in the active
window.
Be careful to distinguish between the active cell and the selection. The active cell is a single cell
inside the current selection. The selection may contain more than one cell, but only one is the
active cell.
The following expressions all return the active cell, and are all equivalent.
active cell
active cell of application
active cell of active window
active cell of active window of application
active chart
Returns a chart object that represents the active chart (either an embedded chart or a chart
sheet). An embedded chart is considered active when it's either selected or activated. When no
chart is active, this property returns an incorrect result. Read-only.
If you don't specify an object qualifier, this property returns the active chart in the active
workbook.
Microsoft Excel Suite
53
active printer
This property is not currently supported.
active sheet
Returns an object that represents the active sheet (the sheet on top) in the active workbook or
in the specified window or workbook. Returns an error if no sheet is active. Read-only.
If you don't specify an object qualifier, this property returns the active sheet in the active
workbook.
If a workbook appears in more than one window, each window might have a different active
sheet.
active window
Returns a window object that represents the active window (the window on top). Read-only.
Returns an incorrect result if there are no windows open.
active workbook
Returns a workbook object that represents the workbook in the active window (the window
on top). Read-only. Returns an incorrect result if there are no windows open or if either the
Info window or the Clipboard window is the active window.
alert before overwriting
True if Excel displays a message before overwriting nonblank cells during a drag-and-drop
editing operation. Read/write.
alt startup path
Returns or sets the name of the alternate startup folder. Read/write.
ask to update links
True if Excel prompts the user to update links when opening files with links. False if links are
automatically updated with no dialog box. Read/write.
autocorrect object
Returns an autocorrect object that represents the Excel AutoCorrect attributes. Read-only.
automation security
Allows Office programs to support security for Visual Basic macros that programmatically
open a document but are uncertain whether the VB macros in a document are safe. A
developer may want to have the VB macro display the security warnings to the user for these
documents.
This property is available in Office 2004 for Mac version 11.1 or later.
Microsoft Excel Suite
54
Returns or sets an automation security value that represents the security mode that an Office
program uses when programmatically opening files. This property is automatically set to
msoAutomationSecurityLow when the program is started. Therefore, to avoid breaking VB
macros that rely on the default setting, be careful to reset this property to
msoAutomationSecurityLow after you open a file programmatically. Also, be sure to set this
property immediately before and after you open a file programmatically, to avoid malicious
subversion.
This property also allows VB macros to choose to open a document and to trigger the
appropriate security warning, which is the same as if an end user is manually opening the
document. This property does not affect the behavior when the end user uses the user interface
(UI) to open files. In this case, this property does not change the settings in the Security pane
(on the Application menu, select Preferences, and then click Security).
Can be one of the following:
Value Description
msoAutomationSecurityLow
Turns on all VB macros and is the default value when
you start the program.
msoAutomationSecurityForceDisabl
e
Disables all VB macros in all files that are opened
programmatically, without showing any security
warnings.
msoAutomationSecurityByUI
Uses the security setting that is controlled in the
Security pane (on the Application menu, select
Preferences, and then click Security).
The value of the display alerts property does not apply to security warnings. For example, if the
user sets the display alerts property equal to false and the automation security property to
msoAutomationSecurityByUI while the user has macro virus protection enabled in the
Security pane (on the Application menu, select Preferences, and then click Security), security
warnings appear while the VB macro is running. This action allows the VB macro to trap "file
open" errors, while still displaying the security warning if the "file open" succeeds.
If the user cancels the command to open the file through the security warning dialog box (by
clicking the Close button in the message), a run-time error occurs with the command that
triggered the "file open." The error code distinguishes between this user UI action and a "file
not found" error.
If the VB macro sets msoAutomationSecurityForceDisable and opens an Excel workbook
with XLM code, the "file open" fails.
build
Returns the Excel build number. Read-only.
It's usually safer to use the version property, unless you're sure you need to know the build
number.
Microsoft Excel Suite
55
calculate before save
True if workbooks are calculated before they're saved to disk (if the calculation property is set
to calculation manual). This property is preserved even if you change the calculation property.
Read/write.
calculation
Returns or sets the calculation mode.
Can be one of the following:
calculation automatic
calculation manual
calculation semiautomatic
calculation version
Returns a number whose rightmost four digits are the minor calculation engine version
number, and whose other digits (on the left) are the major version of Excel. For a workbook
object, this property returns the information about the version of Excel that was used the last
time the workbook was fully recalculated. Read-only.
If the workbook was saved in an earlier version of Excel and if the workbook hasn't been fully
recalculated, then this property returns 0.
caption
Returns the name that appears in the title bar of the main Excel window. If you don't set a
name, or if you set the name to empty, this property returns "Microsoft Excel." Read-only.
cell drag and drop
True if dragging and dropping cells is enabled. Read/write.
command underlines
Returns or sets the state of the command underlines in Excel. Read/write.
Can be one of the following:
command underlines automatic
command underlines off
command underlines on
Microsoft Excel Suite
56
copy objects with cells
True if objects are cut, copied, extracted, and sorted with cells. Read/write.
custom list count
Returns the number of defined custom lists (including built-in lists). Read-only.
cut copy mode
Returns or sets the status of Cut or Copy mode. Read/write.
Can be one of the following:
Return value Description
false
Not in Cut or Copy mode.
copy mode
In Copy mode.
cut mode
In Cut mode.
Set value Description
false
Cancels Cut or Copy mode and removes the moving border.
true
Cancels Cut or Copy mode, removes the moving border, and places the
contents of the selection on the Clipboard.
data entry mode
Returns or sets Data Entry mode, as shown in the following table. When in Data Entry mode,
you can enter data only in the unlocked cells in the currently selected range. Read/write.
Value Description
data entry on
Data Entry mode is turned on.
data entry off
Data Entry mode is turned off.
data entry strict
Data Entry mode is turned on, and pressing ESC won't turn it off.
default file path
Returns or sets the default path that Excel uses when it opens files. Read/write.
Microsoft Excel Suite
57
default save format
Returns or sets the default format for saving files. Read/write.
Can be one of the following:
add in file format
CSV file format
CSV Mac file format
CSV MSDos file format
CSV Windows file format
DBF2 file format
DBF3 file format
DBF4 file format
DIF file format
Excel2 file format
Excel 2 east asian file format
Excel3 file format
Excel4 file format
Excel 4 workbook file format
Excel7 file format
Excel 9795 file format
international add in file format
international macro file format
workbook normal file format
SYLK file format
template file format
current platform text file format
text Mac file format
text MSDos file format
text printer file format
text windows file format
WJ2WD1 file format
Works1 file format
Works 1 all file format
Works 1 fmt file format
Works3 file format
Works 3 fm 3 file format
Works4 file format
works file format
works 2 east asian file format
WQ1 file format
WJ3 file format
WJ3FJ3 file format
HTML file format
XML spreadsheet file format
default web options object
Returns the default web options object that contains global application-level attributes used
by Excel whenever you save a document as a Web page or open a Web page. Read-only.
display alerts
True if Excel displays certain alerts and messages while a script is running. Read/write.
The default value is true. Set this property to false if you don't want to be disturbed by
prompts and alert messages while a script is running; any time a message requires a response,
Excel chooses the default response.
If you set this property to false, Excel doesn't automatically set it back to true when your script
stops running. Your script should always set the property back to true when it stops running.
display comment indicator
Returns or sets the way cells display comments and indicators. Read/write.
Can be one of the following:
no indicator
comment indicator only
comment and indicator
Microsoft Excel Suite
58
display excel 4 menus
True if Excel displays version 4.0 menu bars. Read/write.
display formula bar
True if the formula bar is displayed. Read/write.
display full screen
True if Excel is in full-screen mode. Read/write.
Full-screen mode maximizes the application window so that it fills the entire screen and hides
the application title bar. Toolbars, the status bar, and the formula bar maintain separate
display settings for full-screen mode and normal mode.
display function tooltips
True if function ToolTips can be displayed. Read/write.
display insert options
True if the Insert Options button should be displayed. Read/write.
display note indicator
True if cells containing notes display cell tips and contain note indicators (small dots in their
upper-right corners). Read/write.
display recent files
True if the list of recently used files is displayed on the File menu. Read/write.
display scroll bars
True if scroll bars are visible for all workbooks. Read/write.
display status bar
True if the status bar is displayed. Read/write.
edit directly in cell
True if Excel allows editing in cells. Read/write.
enable animations
True if animated insertion and deletion is enabled. Read/write.
When animation is enabled, inserted worksheet rows and columns appear slowly, and deleted
worksheet rows and columns disappear slowly.
enable autocomplete
True if the AutoComplete feature is enabled. Read/write.
Microsoft Excel Suite
59
enable cancel key
Controls how Excel handles ESC or +period user interruptions to the running procedure.
Read/write.
Can be one of the following:
Value Description
cancel key
disabled
Cancel key trapping is completely disabled.
interrupt
The current procedure is interrupted, and the user can debug or end the
procedure.
error handler
The interrupt is sent to the running procedure as an error, trappable by an
error handler set up with an On Error GoTo statement. The trappable error
code is 18.
Use this property very carefully. If you use cancel key disabled, there's no way to interrupt a
runaway loop or other non-self-terminating code.
The enable cancel key property is always reset to interrupt whenever Excel returns to the idle
state and no code is running. To trap or disable cancellation in your procedure, you must
explicitly change the enable cancel key property every time the procedure is called.
enable events
True if events are enabled for the specified object. Read/write.
enable sound
True if sound is enabled for Microsoft Office. Read/write.
extend list
True if Excel automatically extends formatting and formulas to new data that is added to a list.
Read/write.
To be extended, formats and formulas must appear in at least three of the five list rows or
columns preceding the new row or column, and you must add the data to the bottom or to the
right-hand side of the list.
fixed decimal
All data entered after this property is set to true will be formatted with the number of fixed
decimal places set by the fixed decimal places property. Read/write.
fixed decimal places
Returns or sets the number of fixed decimal places used when the fixed decimal property is set
to true. Read/write.
include empty cells in lists
Returns or sets whether Excel will include or exclude the value of empty cells in range lists.
This property does not return the formulas in range lists, only the values. Read/write.
Microsoft Excel Suite
60
iteration
True if Excel will use iteration to resolve circular references. Read/write.
keep four digit years
True if Excel preserves the display of dates entered with four-digit years. Read/write.
library path
Returns the path to the Library folder. Read-only.
math coprocessor available
True if a math coprocessor is available. Read-only.
max change
Returns or sets the maximum amount of change between each iteration as Excel resolves
circular references. Read/write.
max iterations
Returns or sets the maximum number of iterations that Excel can use to resolve a circular
reference. Read/write.
measurement unit
Returns or sets the measurement unit used when the ruler is displayed in page layout view
and for measurements typed in dialog boxes.
Can be one of the following:
centimeters
inches
millimeters
memory free
Returns the amount of memory (in bytes) available for Excel to use. Read-only.
memory total
Returns the total amount of memory (in bytes) available for Excel, including memory already
in use. This property is a sum of the memory free and memory used totals. Read-only.
memory used
Returns the amount of memory (in bytes) that Excel is currently using. Under Mac OS X, this
property always returns 0. Read-only.
move after return
True if the active cell will be moved as soon as the RETURN key is pressed. Read/write.
To specify the direction in which the active cell is to be moved, use the move after return
direction property.
Microsoft Excel Suite
61
move after return direction
Returns or sets the direction in which the active cell is moved when the user presses ENTER.
Read/write.
Can be one of the following:
toward the bottom
toward the left
toward the right
toward the top
If the move after return property is false, the selection doesn't move at all, regardless of how the
move after return direction property is set.
name
Returns the name of the application. Read-only.
network templates path
Returns the network path where templates are stored. If the network path doesn't exist, this
property returns an empty string. Read-only.
office assistant
Returns an office assistant object for Excel. Read-only.
operating system
Returns the name and version number of the current operating system, for example,
"Macintosh (PowerPC) 10.32". Read-only.
organization name
Returns the registered organization name. Read-only.
path
Returns the complete path of the application's container (folder), excluding the final separator
(":"). Read-only.
path separator
Returns the path separator character (":" on the Macintosh). Read-only.
pivot table selection
True if PivotTable reports use structured selection. Read/write.
prompt for summary info
True if Excel asks for summary information when files are first saved. Read/write.
record relative
True if Visual Basic macros should be recorded using relative cell references (A1); false if
recording uses absolute cell references ($A$1). Read-only.
Microsoft Excel Suite
62
reference style
Returns or sets how Excel displays cell references and row and column headings in either A1
or R1C1 reference style. Read/write.
Can be one of the following:
A1
R1C1
roll zoom
True if the IntelliMouse zooms instead of scrolling. Read/write.
save interval
Sets the time interval, in minutes, at which AutoSave will occur. Read/write.
screen updating
True if screen updating is turned on. Read/write.
Turn screen updating off to speed up your script. You won't be able to see what the script is
doing, but it will run faster.
Remember to set the screen updating property back to true when your script ends.
selection
Returns the selected object in the active window. Read-only.
The returned object type depends on the current selection (for example, if a cell is selected, this
property returns a range object). The selection property returns missing value if there is no
selection.
sheets in new workbook
Returns or sets the number of sheets that Excel automatically inserts into new workbooks.
Read/write.
show chart tip names
True if charts show chart tip names. The default value is true. Read/write.
show chart tip values
True if charts show chart tip values. The default value is true. Read/write.
show tool tips
True if ToolTips are turned on. Read/write.
standard font
Returns or sets the name of the standard font. Read/write.
If you change the standard font by using this property, the change doesn't take effect until you
restart Excel.
Microsoft Excel Suite
63
standard font size
Returns or sets the standard font size, in points. Read/write.
If you change the standard font size by using this property, the change doesn't take effect until
you restart Excel.
startup dialog
True if the Project Gallery is displayed when Excel is opened. Read/write.
startup path
Returns the complete path of the startup folder's container (folder), excluding the final
separator (":"). Read-only.
status bar
Returns or sets the text in the status bar. Read/write.
This property returns false if Excel has control of the status bar. To restore the default status
bar text, set the property to false; this works even if the status bar is hidden.
templates path
Returns the local path where templates are stored. Read-only.
transition menu key
Returns or sets the alternate menu or help key, which is usually "/". Read/write.
transition menu key action
Returns or sets the action taken when the alternate menu key is pressed. Can only be excel
menus. Read/write.
two digit cutoff year
Specifies the cutoff year before which the 21st century is assumed for two-digit years.
Read/write.
usable height
Returns the maximum height (in points) of the space that a window can occupy in the
application window area. Read-only.
usable width
Returns the maximum width (in points) of the space that a window can occupy in the
application window area. Read-only.
user name
Returns or sets the name of the current user. Read/write.
version
Returns the Excel version number. Read-only.
Microsoft Excel Suite
64
Class: autofilter
Plural
autofilters
Elements
filter
Represents autofiltering for the specified worksheet.
Use the autofilter object property of the sheet object to return an autofilter object.
To create an autofilter object for a worksheet, you must turn autofiltering on for a range on the
worksheet either manually or by using the autofilter range command. The following example turns
on autofiltering for columns A through C of the active sheet. Before you run this example, make
sure there is data in the columns or the example will fail.
autofilter range range "A:C"
Properties
range object
Returns a range object that represents the range to which the specified AutoFilter applies.
Read-only.
Class: border
Plural
borders
Represents the border of an object.
Use the get border command to return a single border object and set border properties. The
following example sets the weight of the top border of cell A2.
set theBorder to get border range "A2" which border border top
set weight of theBorder to border weight medium
The following example places a red border of medium weight along the bottom edge of the range
A1:G1.
set theBorder to get border (range "A1:G1" of active sheet) ¬
which border edge bottom
set weight of theBorder to border weight medium
set color index of theBorder to 3
Microsoft Excel Suite
65
Properties
color
This property is not currently supported.
color index
Returns or sets the color of the border. Read/write. The color is specified as an index value
into the current color palette, or as one of the following:
color index automatic
color index none
The following illustration shows the color-index values in the default color palette.
line style
Returns or sets the line style for the border. Read/write.
Can be any of the following:
continuous
dash
dash dot
dash dot dot
dot
double
slant dash dot
line style none
Microsoft Excel Suite
66
line weight
Sets or returns the point size for a border. Read/write.
weight
Returns or sets the weight of the border. Read/write.
Can be any of the following:
border weight hairline
border weight medium
border weight thick
border weight thin
Class: button
Plural
buttons
Elements
character
Represents a button control. The on action property determines the script or Visual Basic macro that
runs when the button is clicked.
Use button index, where index is the entry index number or name to return a single button object.
The following example creates a new button.
make new button at end of worksheet 1 of workbook 1 with properties ¬
{top:100, left position:100, height:24, width:100}
The following example gets the properties of a button object on a worksheet.
get properties of button 1 of worksheet 1 of workbook 1
Properties
accelerator
Returns or sets the accelerator character for this control. Read/write.
add indent
Returns or sets whether text is automatically indented when the text alignment in a cell is set
to equal distribution either horizontally or vertically. Read/write.
This property is not used in U.S. English version of Excel.
Microsoft Excel Suite
67
auto scale font
True if the text in the object changes font size when the object size changes. The default value
is true. Read/write.
auto size
True if the size of the specified object is changed automatically to fit text within its boundaries.
Read/write.
bottom right cell
Returns a range object that represents the cell that lies under the the lower-right corner of the
object. Read-only.
cancel button
Returns or sets whether this button is the Cancel button. Read/write.
caption
Returns or sets the caption for this object. Read/write.
control text
Returns or sets the default text for the control. Read/write.
default button
Returns or sets whether this button is the default button. Read/write.
dismiss button
Returns or sets whether this button is the Dismiss button. Read/write.
enabled
True if the object is enabled. Read/write.
entry index
Returns the index number of the object within the elements of the parent object. Read-only.
font object
Returns a font object that represents the font of the specified object. Read-only.
formula
Returns or sets the object's formula in A1-style notation. Read/write.
height
Returns or sets the height (in points) of the object. Read/write.
help button
Returns or sets whether this button is the Help button. Read/write.
Microsoft Excel Suite
68
horizontal alignment
Returns or sets the horizontal alignment for the object. Read/write.
Can be one of the following:
horizontal align center
horizontal align center across selection
horizontal align distributed
horizontal align fill
horizontal align general
horizontal align justify
horizontal align left
horizontal align right
The horizontal align distributed alignment style works only in the Japanese version of Excel
or in an English version of Excel that you have registered as Japanese by using the Microsoft
Language Register application.
left position
Returns or sets the position (in points) of the specified object. Read/write.
locked
True if the object is locked; false if the object can be modified when the sheet is protected.
Read/write.
locked text
True if the text in the specified object will be locked to prevent changes when the workbook is
protected. Read/write.
name
Returns or sets the name of the object. Read/write.
on action
Returns or sets either the name of the script or VB macro that's run when the specified object is
clicked. AppleScript scripts are not saved with the document. Read/write.
orientation
Returns or sets the object's orientation. Read/write.
Can be one of the following:
orientation down
orientation horizontal
orientation upward
orientation vertical
Can also be a number value between -90 and 90 degrees.
Microsoft Excel Suite
69
phonetic accelerator
This property is not currently supported.
placement
Returns or sets the way the object is attached to the cells below it. Read/write.
Can be one of the following:
placement free floating
placement move
placement move and size
print object
True if the object will be printed when the document is printed. Read/write.
reading order
Returns or sets the reading order for the specified object. Can be any of the following
constants: left to right, right to left, context. Read/write.
This property is not supported on the Macintosh.
top
Returns or sets the top position (in points) of the specified object. Read/write.
top left cell
Returns a range object that represents the cell that lies under the upper-left corner of the
specified object. Read-only.
vertical alignment
Returns or sets the vertical alignment of the object. Read/write.
Can be any of the following:
vertical alignment top
vertical alignment center
vertical alignment bottom
vertical alignment justify
vertical alignment distributed
The vertical alignment distributed alignment style works only in the Japanese version of
Excel or in an English version of Excel that you have registered as Japanese by using the
Microsoft Language Register application.
Microsoft Excel Suite
70
visible
True if the object is visible. Read/write.
width
Returns or sets an object's width, in points. Read/write.
wrap auto text
True if Excel wraps the text in the object. Read/write.
z order position
Returns the position of the object in the z-order, which corresponds to the object's index
number. Read-only.
Whenever you make a new shape or object, it's added to the front of the z-order by default.
Class: calculated field
Plural
calculated fields
Represents a calculated field in a PivotTable report.
Use calculated field index, where index is the calculated field's name or index number, to return a
single calculated field object. For example, a PivotTable report that contains Revenue and Expense
fields could have a calculated field named "Profit" defined as the amount in the Revenue field minus
the amount in the Expense field.
The following example deletes the calculated fields from the PivotTable report named "Pivot1" on
worksheet 1.
repeat with fld in (get calculated fields of ¬
pivot table "Pivot1" of worksheet 1)
delete fld
end repeat
Properties
<Inheritance> pivot field
Inherits the properties and elements of the pivot field class.
Class: calculated item
Plural
calculated items
Represents a calculated item in a PivotTable report.
Use calculated item index, where index is the calculated item's name or index number, to return a
single calculated item object. For example, a PivotTable report that contains January, February, and
March items could have a calculated item named "FirstQuarter" defined as the sum of the amounts
in January, February, and March.
Microsoft Excel Suite
71
The following example creates a list of the calculated items in the first PivotTable report on
worksheet 1, along with their formulas.
set pt to pivot table 1 of worksheet 1
set r to 0
repeat with ci in (get calculated items of pivot field "Sales of pt")
set r to r + 1
set value of cell r of column 1 of worksheet 2 to (get name of ci)
set value of cell r of column 2 of worksheet 2 to (get formula of ci)
end repeat
Properties
<Inheritance> pivot item
Inherits the properties and elements of the pivot item class.
Class: chart sheet
Plural
chart sheets
Represents a chart sheet in a workbook.
Use chart sheet index, where index is the chart-sheet index number or name, to return a single chart
sheet object. The following example creates a chart sheet from a randomly generated set of data.
select range "A1:C5"
set value of selection to "=rand()"
make new chart sheet at active workbook
The chart index number represents the position of the chart sheet on the workbook tab bar.
chart
sheet 1 is the first (leftmost) chart in the workbook; chart sheet (get count of chart
sheets) is the last (rightmost). All chart sheets are included in the index count, even if they're
hidden. The chart-sheet name is shown on the workbook tab for the chart.
The following example moves chart sheet 1 to the last (rightmost) position on the workbook tab bar.
move chart sheet 1 to after sheet (get count of sheets)
The following example changes the color of series 1 on the active chart.
make new chart at the beginning of active workbook
set color index of interior object of series 1 of active chart to 3
Properties
<Inheritance> sheet
Inherits the properties and elements of the sheet class.
chart
Returns the chart for this chart sheet. Read-only.
Microsoft Excel Suite
72
Class: checkbox
Plural
checkboxes
Elements
character
Represents a checkbox control.
Use checkbox index, where index is the entry index number or name to return a single checkbox
object. The following example creates a new checkbox.
make new checkbox at end of worksheet 1 of workbook 1 ¬
with properties {top:100, left position:100, ¬
height:24, width:100}
The following example gets the properties of a checkbox object on a worksheet.
get properties of checkbox 1 of worksheet 1 of workbook 1
Properties
accelerator
Returns or sets the accelerator character for this control. Read/write.
border
Returns a border object that represents the border of the object. Read-only.
bottom right cell
Returns a range object that represents the cell that lies under the lower-right corner of the
object. Read-only.
caption
Returns or sets the caption for this object. Read/write.
control text
Returns or sets the default text for the control. Read/write.
display threeD shading
Returns or sets the 3-D shading for this object. Read/write.
enabled
True if the object is enabled. Read/write.
entry index
Returns the index number of the object within the elements of the parent object. Read-only.
height
Returns or sets the height (in points) of the object. Read/write.
Microsoft Excel Suite
73
interior object
Returns an interior object that represents the interior of the specified object. Read-only.
left position
Returns or sets the position (in points) of the specified object. Read/write.
linked cell
Returns or sets the worksheet range linked to the control's value. If you place a value in the
cell, the control takes this value. Likewise, if you change the value of the control, that value is
also placed in the cell. Read/write.
locked
True if the object is locked; false if the object can be modified when the sheet is protected.
Read/write.
locked text
True if the text in the specified object will be locked to prevent changes when the workbook is
protected. Read/write.
name
Returns or sets the name of the object. Read/write.
on action
Returns or sets either the name of the script or VB macro that runs when the specified object is
clicked. AppleScript scripts are not saved with the document. Read/write.
phonetic accelerator
This property is not currently supported.
placement
Returns or sets the way the object is attached to the cells below it. Read/write.
Can be one of the following:
placement free floating
placement move
placement move and size
print objects
True if the object will be printed when the document is printed. Read/write.
top
Returns or sets the top position (in points) of the specified object. Read/write.
top left cell
Returns a range object that represents the cell that lies under the upper-left corner of the
specified object. Read-only.
Microsoft Excel Suite
74
value
Returns or sets the value of the control. Read/write.
Can be one of the following:
checkbox off
checkbox on
checkbox mixed
visible
True if the object is visible. Read/write.
width
Returns or sets the width (in points) of an object. Read/write.
z order position
Returns the position of the specified object in the z-order, which corresponds to the object's
index number. Read-only.
Whenever you make a new shape or object, it's added to the front of the z-order by default.
Class: child item
Plural
child items
Represents a child item in a PivotTable report.
Use child item index, where index is the child item's name or index number, to return a single child
item object. This example adds the names of all the child items of the pivot item named "Vegetables"
to a list on a new worksheet.
set nwSheet to make new worksheet
activate object nwSheet
set pvtTable to pivot table of range "A1" of worksheet "Sheet2"
set rw to 0
repeat with pvtItem in (get child items of pivot item "Vegetables" ¬
of pivot field "Product" of pvtTable)
set rw to rw + 1
set value of cell rw of column 1 of nwSheet to (get name of pvtItem)
end repeat
Properties
<Inheritance> pivot item
Inherits the properties and elements of the pivot item class.
Microsoft Excel Suite
75
Class: column field
Plural
column fields
Represents a column field in a PivotTable report.
Use column field index, where index is the column field's name or index number, to return a single
column field object.
This example adds the field names of the PivotTable columns to a list on a new worksheet.
set nwSheet to make new worksheet
activate object nwSheet
set pvtTable to pivot table of range "A1" of worksheet "Sheet2"
set rw to 0
repeat with pvtField in (get column fields of pvtTable)
set rw to rw + 1
set value of cell rw of column 1 of nwSheet to (get name of pvtField)
end repeat
Properties
<Inheritance> pivot field
Inherits the properties and elements of the pivot field class.
Class: custom view
Plural
custom views
Represents a custom workbook view.
Use custom views index, where index is the name or index number of the custom view, to return a
custom view object. The following example shows the custom view named "Current Inventory."
show custom view custom view "Current Inventory" of active workbook
Properties
name
Returns the name of the object. Read-only.
print settings
True if print settings are included in the custom view. Read-only.
row col settings
True if the custom view includes settings for hidden rows and columns (including filter
information). Read-only.
Microsoft Excel Suite
76
Class: data field
Plural
data fields
Represents a data field in a PivotTable report.
Use data field index, where index is the data field's name or index number, to return a single data
field object.
This example adds the names for the PivotTable data fields to a list on a new worksheet.
set nwSheet to make new worksheet
activate object nwSheet
set pvtTable to pivot table of range "A1" of worksheet "Sheet2"
set rw to 0
repeat with pvtField in (get data fields of pvtTable)
set rw to rw +1
set value of cell rw of column 1 of nwSheet to (get name of pvtField)
end repeat
Properties
<Inheritance> pivot field
Inherits the properties and elements of the pivot field class.
Class: default web options
Contains global application-level attributes used by Excel when you save a document as a Web page
or open a Web page. You can return or set attributes either at the application (global) level or at the
workbook level. (Note that attribute values can be different from one workbook to another,
depending on the attribute value at the time the workbook was saved.) Workbook-level attribute
settings override application-level attribute settings. Workbook-level attributes are contained in the
web options object.
Use the default web options object property of the application class to return the default web options
object. The following example checks to see whether PNG (Portable Network Graphics) is allowed
as an image format and sets the
strImageFileType variable accordingly.
set objAppWebOptions to default web options object
if allow png of objAppWebOptions is true then
set strImageFileType to "PNG"
else
set strImageFileType to "JPG"
end if
Microsoft Excel Suite
77
Properties
allow png
True if PNG (Portable Network Graphics) is allowed as an image format when you save or
publish a complete or partial presentation as a Web page. False if PNG is not allowed as an
output format. The default value is False. Read/write.
If you save images in the PNG format as opposed to any other file format, you might improve
the image quality or reduce the size of those image files, and therefore decrease the download
time, assuming that the Web browsers you are targeting support the PNG format.
always save in default encoding
True if the default encoding is used when you save a Web page or plain text document,
independent of the file's original encoding when opened. False if the original encoding of the
file is used. The default value is false. Read/write.
encoding
Returns or sets the document encoding (code page or character set) to be used by the Web
browser when you view the saved document. Read/write.
The default is encoding Mac Roman. Can be any of the following:
encoding Thai
encoding Japanese ShiftJIS
encoding simplified Chinese
encoding Korean
encoding traditional Chinese
encoding little endian
encoding big endian
encoding central European
encoding Cyrillic
encoding Western
encoding Greek
encoding Turkish
encoding Hebrew
encoding Arabic
encoding Baltic
encoding Vietnamese
encoding auto detect
encoding Japanese auto detect
encoding simplified Chinese auto detect
encoding Korean auto detect
encoding traditional Chinese auto detect
encoding Cyrillic auto detect
encoding Greek auto detect
encoding Arabic auto detect
encoding ISO88591 Latin1
encoding ISO88592 central Europe
encoding ISO88593 Latin3
encoding ISO88594 Baltic
encoding ISO88595 Cyrillic
encoding ISO88596 Arabic
encoding ISO88597 Greek
encoding ISO88598 Hebrew
encoding EBCDIC Greek
encoding EBCDIC Hebrew
encoding EBCDIC Korean extended
encoding EBCDIC Thai
encoding EBCDIC Icelandic
encoding EBCDIC Turkish
encoding EBCDIC Russian
encoding EBCDIC Serbian Bulgarian
encoding EBCDIC Japanese Katakana
extended and Japanese
encoding EBCDIC US Canada and Japanese
encoding EBCDIC extended and Korean
encoding EBCDIC simplified Chinese
extended and simplified Chinese
encoding EBCDIC US Canada
and traditional Chinese
encoding EBCDIC Japanese Latin extended
and Japanese
encoding OEM United States
encoding OEM Greek
encoding OEM Baltic
encoding OEM multilingual LatinI
encoding OEM multilingual LatinII
encoding OEM Cyrillic
encoding OEM Turkish
encoding OEM Portuguese
encoding OEM Icelandic
encoding OEM Hebrew
encoding OEM Canadian French
encoding OEM Arabic
encoding OEM Nordic
encoding OEM CyrillicII
Microsoft Excel Suite
78
encoding ISO88599 Turkish
encoding ISO885915 Latin9
encoding ISO2022 Japanese no half width
Katakana
encoding ISO2022 Japanese JISX02021984
encoding ISO2022 Japanese JISX02011989
encoding ISO2022KR
encoding ISO2022CN traditional Chinese
encoding ISO2022CN simplified Chinese
encoding Mac Roman
encoding Mac Japanese
encoding Mac traditional Chinese Big5
encoding Mac Korean
encoding Mac Greek1
encoding Mac Cyrillic
encoding Mac simplified Chinese GB2312
encoding Mac Romania
encoding Mac Ukraine
encoding Mac Latin2
encoding Mac Icelandic
encoding Mac Turkish
encoding Mac Croatia
encoding EBCDIC US Canada
encoding EBCDIC International
encoding EBCDIC multilingual
ROECE Latin2
encoding EBCDIC Greek modern
encoding EBCDIC Turkish Latin5
encoding EBCDIC Germany
encoding EBCDIC Denmark Norway
encoding EBCDIC Finland Sweden
encoding EBCDIC Italy
encoding EBCDIC Latin America Spain
encoding EBCDIC United Kingdom
encoding EBCDIC Japanese
Katakana extended
encoding EBCDIC France
encoding EBCDIC Arabic
encoding OEM modern Greek
encoding EUC Japanese
encoding EUC Chinese simplified Chinese
encoding EUC Korean
encoding EUC Taiwanese
traditional Chinese
encoding Devanagari
encoding Bengali
encoding Tamil
encoding Telugu
encoding Assamese
encoding Oriya
encoding Kannada
encoding Malayalam
encoding Gujarati
encoding Punjabi
encoding Arabic ASMO
encoding Arabic transparent ASMO
encoding Korean Johab
encoding Taiwan CNS
encoding Taiwan TCA
encoding Taiwan Eten
encoding Taiwan IBM5550
encoding Taiwan teletext
encoding Taiwan Wang
encoding IA5 German
encoding IA5 Swedish
encoding IA5 Norwegian
encoding US ASCII
encoding T61
encoding ISO6937 nonspacing accent
encoding Ext alpha lowercase
encoding KOI8U
encoding Europa3
encoding HZGB simplified Chinese
encoding UTF7
encoding UTF8
load pictures
This property is not currently supported.
location of components
This property is not currently supported.
pixels per inch
Returns or sets the density (pixels per inch) of graphics images and table cells on a Web page.
The range of settings is usually from 19 to 480. Common settings for popular screen sizes are
72, 96, and 120. The default setting is 96. Read/write.
Microsoft Excel Suite
79
This property determines the size of the images and cells on the specified Web page relative to
the size of text whenever you view the saved document in a Web browser. The physical
dimensions of the resulting image or cell are the result of the original dimensions (in inches)
multiplied by the number of pixels per inch.
To set the optimum screen size for the targeted Web browsers, use the screen size property.
save hidden data
True if data outside of the specified range is saved when you save the document as a Web
page. This data may be necessary for maintaining formulas. False if data outside of the
specified range is not saved with the Web page. The default value is true. Read/write.
If you choose not to save data outside of the specified range, references to that data in the
formula are converted to static values. If the data is in another sheet or workbook, the result of
the formula is saved as a static value.
screen size
Returns or sets the ideal minimum screen size (width by height, in pixels) that you should use
when viewing the saved document in a Web browser. Read/write.
Can be one of the following:
resolution544x376
resolution640x480
resolution720x512
resolution800x600
resolution1024x768
resolution1152x882
resolution1152x900
resolution1280x1024
resolution1600x1200
resolution1800x1440
resolution1920x1200
The default value is resolution800x600.
update links on save
True if hyperlinks and paths to all supporting files are automatically updated before you save
the document as a Web page, ensuring that the links are up-to-date at the time the document is
saved. False if the links are not updated. The default value is true. Read/write.
You should set this property to false if the location where the document is saved is different
from the final location on the Web server and the supporting files are not available at the first
location.
use long file names
True if long file names are used when you save the document as a Web page. False if long file
names are not used and the MS-DOS file name format (8.3) is used. The default value is true.
Read/write.
If you don't use long file names and your document has supporting files, Excel automatically
organizes those files in a separate folder.
Microsoft Excel Suite
80
Class: dialog
Plural
dialogs
Represents a built-in dialog box. The dialogs list contains all of the built-in dialog boxes in Excel.
You cannot create a new built-in dialog box or add one to the dialogs list.
To return a single dialog object, use the get dialog command along with a dialog type constant that
identifies the dialog box. The following example displays and carries out the actions taken in the
built-in Open dialog box (File menu).
show (get dialog dialog open)
The dialog type constants are formed from the prefix "dialog" followed by the name of the dialog
box. For example, the constant for the Page Setup dialog box is dialog page setup, and the constant
for the Project Gallery dialog box is dialog new.
Class: document
Plural
documents
Represents a Microsoft Excel workbook.
Use document index, where index is the workbook name or index number, to return a single
document object. The following example creates a new workbook.
make new document
Note In most cases, it's best to use the workbook class
Properties
<Inheritance> workbook
Inherits the properties and elements of the workbook class.
Class: dropdown
Plural
dropdowns
Elements
character
Represents a dropdown control.
Use dropdown index, where index is the entry index number or name, to return a single dropdown
object. The following example creates a new dropdown.
make new dropdown at end of worksheet 1 of workbook 1 with properties ¬
{top:100, left position:100, height:24, width:100}
Microsoft Excel Suite
81
The following example gets the properties of a dropdown object on a worksheet.
get properties of dropdown 1 of worksheet 1 of workbook 1
Properties
bottom right cell
Returns a range object that represents the cell that lies under the lower-right corner of the
object. Read-only.
caption
Returns or sets the caption for this object. Read/write.
control text
Returns or sets the default text for the control. Read/write.
display threeD shading
Returns or sets the 3-D shading for this object. Read/write.
drop down lines
Returns or sets the number of dropdown items. Read/write.
enabled
True if the object is enabled. Read/write.
entry index
Returns the index number of the object within the elements of the parent object. Read-only.
height
Returns or sets the height (in points) of the object. Read/write.
left position
Returns or sets the position (in points) of the specified object. Read/write.
linked cell
Returns or sets the worksheet range linked to the control's value. If you place a value in the
cell, the control takes this value. Likewise, if you change the value of the control, that value is
also placed in the cell. Read/write.
list fill range
Returns or sets the worksheet range used to fill the specified dropdown. Setting this property
destroys any existing list in the dropdown. Read/write.
Excel reads the contents of every cell in the range and inserts the cell values into the
dropdown. The list tracks changes in the cells within that range.
If the list in the dropdown was created with the add item to list command, this property
returns an empty string ("").
list index
Returns or sets the index number of the currently selected item in a dropdown. Read/write.
Microsoft Excel Suite
82
locked
True if the object is locked; false if the object can be modified when the sheet is protected.
Read/write.
name
Returns or sets the name of the object. Read/write.
number of items in list
Returns the total number of items in the list. Read-only.
on action
Returns or sets either the name of the script VB macro that runs when the specified object is
clicked. AppleScript scripts are not saved with the document. Read/write.
placement
Returns or sets the way the object is attached to the cells below it. Read/write.
Can be one of the following:
placement free floating
placement move
placement move and size
print object
True if the object will be printed when the document is printed. Read/write.
top
Returns or sets the top position (in points) of the specified object. Read/write.
top left cell
Returns a range object that represents the cell that lies under the upper-left corner of the
specified object. Read-only.
value
Returns or sets the value of the control. Read/write.
visible
True if the object is visible. Read/write.
width
Returns or sets an object's width, in points. Read/write.
z order position
Returns the position of the object in the z-order, which corresponds to the object's index
number. Read-only.
Whenever you make a new shape or object, it's added to the front of the z-order by default.
Microsoft Excel Suite
83
Class: Excel comment
Plural
Excel comments
Represents a cell comment.
Use the Excel comment property to return an Excel comment object. The following example changes
the text in the comment in cell E5.
Excel comment text (Excel comment of range "E5") text "reviewed by Jessica"
Use Excel comment index, where index is the comment number, to return a single Excel comment
object. The following example hides comment two on worksheet one.
set visible of Excel comment 2 of sheet 1 to false
To add a comment to a range, use the add comment command. The following example adds a
comment to cell E5 on worksheet one.
add comment range "E5" of sheet 1 comment text "reviewed by Jessica"
Properties
author
Returns or sets the author of the comment. Read-only.
shape object
Returns a shape object that represents the shape attached to the specified comment. Read-only.
visible
True if the object is visible. Read/write.
Class: filter
Plural
filters
Represents a filter for a single column. The filter list contains all the filters in an autofiltered range.
Use filter index, where index is the filter title or index number, to return a single filter object. The
following example sets a variable to the value of the filter on property of the filter for the first
column in the filtered range on the Crew worksheet.
set w to worksheet "Crew"
if autofilter mode of w is true then
set filterIsOn to (filter on of filter 1 of autofilter object of w)
end if
Microsoft Excel Suite
84
Note that all the properties of the filter object are read-only. To set these properties, apply
autofiltering manually or using the autofilter range command, as shown in the following example.
set w to worksheet "Crew"
autofilter range (cells of w) field 2 criteria1 "Crucial" ¬
operator autofilter or criteria2 "Important"
Properties
criteria1
Returns the first filtered value for the specified column in a filtered range. Read-only.
criteria2
Returns the second filtered value for the specified column in a filtered range. Read-only.
If you try to access the criteria2 property for a filter that does not use two criteria, an error will
occur. Check that the operator property of a filter object doesn't equal zero (0) before trying to
access the criteria2 property.
filter on
True if the specified filter is on. Read-only
operator
Returns the operator that associates the two criteria applied by the specified filter. Read-only.
Can be one of the following:
autofilter and
bottom 10 items
bottom 10 percent
autofilter or
top 10 items
top 10 percent
Class: format condition
Plural
format conditions
Represents a conditional format.
Use format condition index, where index is the index number of the conditional format, to return a
format condition object. The following example creates a new conditional format for cells E1:E10:
make new format condition at range
"E1:E10" with properties ¬
{format condition type:cell value, ¬
condition operator:operator between, ¬
formula1:"1", formula2:"10"}
Microsoft Excel Suite
85
To control the appearance of formatted cells, use the font object and interior object properties of the
format condition object. Some properties of these objects aren't supported by the conditional format
object model. The properties that can be used with conditional formatting are listed in the following
table.
Object Properties
font bold
color
colorIndex
fontStyle
italic
strikethrough
underline
The accounting underline styles cannot be used.
interior color
colorIndex
pattern
patternColorIndex
Properties
condition operator
Returns the operator for the conditional format. Read-only.
Can be one of the following:
operator between
operator not between
operator equal
operator not equal
operator greater
operator less
operator greater equal
operator less equal
font object
Returns a font object that represents the font of the specified object. Read-only.
format condition type
Returns the conditional format type. Read-only.
Can be one of the following:
cell value
expression
Microsoft Excel Suite
86
formula 1
Returns the value or expression associated with the conditional format. Can be a constant
value, a string value, a cell reference, or a formula. Read-only.
formula 2
Returns the value or expression associated with the second part of a conditional format. Used
only when the condition operator property is operator between or operator not between. Can
be a constant value, a string value, a cell reference, or a formula. Read-only.
interior object
Returns an interior object that represents the interior of the specified object. Read-only.
Class: graphic
Plural
graphics
Contains properties that apply to header and footer picture objects.
The following properties of the page setup object are graphic objects: center footer picture, center
header picture, left footer picture, left header picture, right footer picture, or right header picture.
The following example adds a picture named "Sample.jpg" from the Macintosh HD volume to the
left section of the footer, and sets the color type of the graphic to a watermark effect. This example
assumes that a file named "Sample.jpg" exists on the Macintosh HD volume.
set file name of left footer picture of page setup object ¬
of active sheet to "Macintosh HD: Sample.jpg"
set color type of page setup object of active sheet ¬
to picture color watermark
set left header of page setup object of active sheet to "&G"
Note The characters "&G" must be part of the left footer string for the image to show up in the left
footer.
Properties
brightness
Returns or sets the brightness of the specified picture or OLE object. The value for this
property must be a number from 0.0 (dimmest) to 1.0 (brightest). Read/write.
Microsoft Excel Suite
87
color type
Returns or sets the type of color transformation applied to the specified picture or OLE object.
Read/write.
Can be one of the following:
picture color type unset
picture color automatic
picture color gray scale
picture color black and white
picture color watermark
contrast
Returns or sets the contrast for the specified picture or OLE object. The value for this property
must be a number from 0.0 (the least contrast) to 1.0 (the greatest contrast). Read/write.
crop bottom
Returns or sets the number of points that are cropped off the bottom of the specified picture or
OLE object. Read/write.
Cropping is calculated relative to the original size of the picture. For example, if you insert a
picture that is originally 100 points high, rescale it so that it's 200 points high, and then set the
crop bottom property to 50, 100 points (not 50) will be cropped off the bottom of your picture.
However, while cropping measurements are calculated relative to the object's original scale,
those measurements reflect absolute distances from the edge of the object. You cannot set any
of the cropping properties to a negative number.
crop left
Returns or sets the number of points that are cropped off the left side of the specified picture
or OLE object. Read/write.
Cropping is calculated relative to the original size of the picture. For example, if you insert a
picture that is originally 100 points wide, rescale it so that it's 200 points wide, and then set the
crop left property to 50, 100 points (not 50) will be cropped off the left side of your picture.
However, while cropping measurements are calculated relative to the object's original scale,
those measurements reflect absolute distances from the edge of the object. You cannot set any
of the cropping properties to a negative number.
crop right
Returns or sets the number of points that are cropped off the right side of the specified picture
or OLE object. Read/write.
Cropping is calculated relative to the original size of the picture. For example, if you insert a
picture that is originally 100 points wide, rescale it so that it's 200 points wide, and then set the
crop right property to 50, 100 points (not 50) will be cropped off the right side of your picture.
However, while cropping measurements are calculated relative to the object's original scale,
those measurements reflect absolute distances from the edge of the object. You cannot set any
of the cropping properties to a negative number.
Microsoft Excel Suite
88
crop top
Returns or sets the number of points that are cropped off the top of the specified picture or
OLE object. Read/write.
Cropping is calculated relative to the original size of the picture. For example, if you insert a
picture that is originally 100 points high, rescale it so that it's 200 points high, and then set the
crop top property to 50, 100 points (not 50) will be cropped off the top of your picture.
However, while cropping measurements are calculated relative to the object's original scale,
those measurements reflect absolute distances from the edge of the object. You cannot set any
of the cropping properties to a negative number.
file name
Returns or sets the URL (on the intranet or the Web) or path (local or network) to the location
where the specified source object was saved. Read/write.
The file name property generates an error if a folder in the specified path doesn’t exist.
height
Returns or sets the height (in points) of an object. Read/write.
lock aspect ratio
True if the specified shape retains its original proportions when you resize it. False if you can
change the height and width of the shape independently of one another when you resize it.
Read/write.
width
Returns or sets an object's width, in points. Read/write.
Class: groupbox
Plural
groupboxes
Elements
character
Represents a groupbox control.
Use groupbox index, where index is the entry index number or name to return a single groupbox
object. The following example creates a new groupbox.
make new groupbox at end of worksheet 1 of workbook 1 with properties
{top:100, left position:100, height:24, width:100}
The following example gets the properties of a groupbox object on a worksheet.
get properties of groupbox 1 of worksheet 1 of workbook 1
Microsoft Excel Suite
89
Properties
accelerator
Returns or sets the accelerator character for this control. Read/write.
bottom right cell
Returns a range object that represents the cell that lies under the lower-right corner of the
object. Read-only.
caption
Returns or sets the caption for this object. Read/write.
control text
Returns or sets the default text for the control. Read/write.
display threeD shading
Returns or sets the 3-D shading for this object. Read/write.
enabled
True if the object is enabled. Read/write.
entry index
Returns the index number of the object within the elements of the parent object. Read-only.
height
Returns or sets the height (in points) of the object. Read/write.
left position
Returns or sets the position (in points) of the specified object. Read/write.
locked
True if the object is locked; false if the object can be modified when the sheet is protected.
Read/write.
locked text
True if the text in the specified object will be locked to prevent changes when the workbook is
protected. Read/write.
name
Returns or sets the name of the object. Read/write.
on action
Returns or sets either the name of a script or VB macro that runs when the specified object is
clicked. AppleScript scripts are not saved with the document. Read/write.
phonetic accelerator
This property is not currently supported.
Microsoft Excel Suite
90
placement
Returns or sets the way the object is attached to the cells below it. Read/write.
Can be one of the following:
placement free floating
placement move
placement move and size
print object
True if the object will be printed when the document is printed. Read/write.
top
Returns or sets the top position (in points) of the specified object. Read/write.
top left cell
Returns a range object that represents the cell that lies under the upper-left corner of the
specified object. Read-only.
visible
True if the object is visible. Read/write.
width
Returns or sets an object's width, in points. Read/write.
z order position
Returns the position of the object in the z-order, which corresponds to the object's index
number. Read-only.
Whenever you make a new shape or object, it's added to the front of the z-order by default.
Class: hidden field
Plural
hidden fields
Represents a hidden field in a PivotTable report.
Use hidden field index, where index is the hidden field's name or index number, to return a single
hidden field object.
This example adds the hidden field names to a list on a new worksheet.
set nwSheet to make new worksheet
activate object nwSheet
set pvtTable to pivot table of range "A1" of worksheet "Sheet2"
set rw to 0
repeat with pvtField in (get hidden fields of pvtTable)
set rw to rw + 1
set value of cell rw of column 1 of nwSheet to (get name of pvtField)
end repeat
Microsoft Excel Suite
91
Properties
<Inheritance> pivot field
Inherits the properties and elements of the pivot field class.
Class: hidden item
Plural
hidden items
Represents a hidden item in a PivotTable report.
Use hidden item index, where index is the hidden item's name or index number, to return a single
hidden item object.
Use hidden items index, where index is the pivot item name or number (can be an array to specify
more than one item).
This example adds the names of all the hidden items in the field named "product" to a list on a new
worksheet.
set nwSheet to make new worksheet
activate object nwSheet
set pvtTable to pivot table of range "A1" of worksheet "Sheet2"
set rw to 0
repeat with pvtItem in (get hidden items of pivot field "product" of pvtTable)
set rw to rw + 1
set value of cell rw of column 1 of nwSheet to (get name of pvtItem)
end repeat
Properties
<Inheritance> pivot item
Inherits the properties and elements of the pivot item class.
Class: horizontal page break
Plural
horizontal page breaks
Represents a horizontal page break.
Use horizontal page break index, where index is the index number of the page break, to return a
horizontal page break object. The following example creates new horizontal page breaks on the
active sheet.
make new horizontal page break at active sheet ¬
with properties {location:range ("E5")}
make new horizontal page break at active sheet ¬
with properties {location:range ("C10"),
extent:page break full, ¬
horizontal page break type:page break manual}
Microsoft Excel Suite
92
Properties
extent
Returns the type of the specified page break: full-screen or only within a print area. Read-only.
Can be one of the following:
page break full
page break partial
horizontal page break type
Returns or sets the type of horizontal page break. Read/write.
Can be one of the following:
page break automatic
page break manual
page break none
location
Returns or sets the cell (a range object) that defines the page-break location. Horizontal page
breaks are aligned with the top edge of the location cell; vertical page breaks are aligned with
the left edge of the location cell. Read/write.
Class: hyperlink
Plural
hyperlinks
Represents a hyperlink.
The following example activates the hyperlink for range A1.
set var to hyperlink 1 of range "A1" of active sheet
follow var
A range or worksheet can have more than one hyperlink. Use hyperlink index, where index is the
hyperlink number, to return a single hyperlink object. The following example activates hyperlink
two in the range A1:B2.
set var to hyperlink 2 of range "A1:B2" of active sheet
follow var
Use the hyperlink property to return the hyperlink object for a shape (a shape can have only one
hyperlink).
Microsoft Excel Suite
93
Properties
address
Returns or sets the address of the target document. Read/write.
email subject
Returns or sets the text string of the specified hyperlink's e-mail subject line. The subject line is
appended to the hyperlink's address. Read/write.
This property is usually used with e-mail hyperlinks.
The value of this property takes precedence over any e-mail subject line you have specified by
using the address property of the same hyperlink object.
hyperlink type
Returns the hyperlink type (the type of data or object that the hyperlink is associated with).
Read-only.
Can be any of the following:
hyperlink type text range
hyperlink type shape
hyperlink type inline shape
name
Returns the name of the object. Read-only.
range object
Returns a range object that represents the range the specified hyperlink is attached to. Read-
only.
screen tip
Returns or sets the ScreenTip text for the specified hyperlink. Read/write.
After the document has been saved to a Web page, the ScreenTip text may appear (for
example) when the mouse pointer is positioned over the hyperlink while the document is
being viewed in a Web browser. Some Web browsers may not support ScreenTips.
shape object
Returns a shape object that represents the shape attached to the specified hyperlink. Read-
only.
sub address
Returns or sets the location within the document associated with the hyperlink. Read/write.
text to display
Returns or sets the text to be displayed for the specified hyperlink. The default value is the
address of the hyperlink. Read/write.
Microsoft Excel Suite
94
Class: international macro sheet
Plural
international macro sheets
Represents an international macro sheet.
Use international macro sheet index, where index is the macro sheet index number or name, to
return a single international macro sheet object. The following example creates a new international
macro sheet.
make new international macro sheet at the beginning of active workbook
Properties
<Inheritance> sheet
Inherits the properties and elements of the sheet class.
enable selection
Returns or sets what can be selected on the sheet. This property takes effect only when the
worksheet is protected. Read/write.
Can be one of the following:
Value Description
no restrictions
Allows any cell to be selected.
unlocked cells
Allows only those cells whose locked property is false to be selected.
no selection
Prevents any selection on the sheet.
Class: label
Plural
labels
Represents a label control.
Use label index, where index is the label control's name or index number, to return a single label
object. The following example creates a new label control:
make new label at end of worksheet 1 of workbook 1 with properties
{top:100, left position:100, height:24, width:100}
Properties
accelerator
Returns or sets the accelerator character for this control. Read/write.
bottom right cell
Returns a range object that represents the cell that lies under the lower-right corner of the
object. Read-only.
Microsoft Excel Suite
95
caption
Returns or sets the caption for this object. Read/write.
control text
Returns or sets the default text for the control. Read/write.
enabled
True if the object is enabled. Read/write.
entry index
Returns the index number of the object within the elements of the parent object. Read-only.
height
Returns or sets the height (in points) of the object. Read/write.
left position
Returns or sets the position (in points) of the specified object. Read/write.
locked
True if the object is locked; false if the object can be modified when the sheet is protected.
Read/write.
locked text
True if the text in the specified object will be locked to prevent changes when the workbook is
protected. Read/write.
name
Returns or sets the name of the object. Read/write.
on action
Returns or sets either the name of a script or VB macro that runs when the specified object is
clicked. AppleScript scripts not saved with the document. Read/write.
phonetic accelerator
This property is not currently supported.
placement
Returns or sets the way the object is attached to the cells below it. Read/write.
Can be one of the following:
placement free floating
placement move
placement move and size
print object
True if the object will be printed when the document is printed. Read/write.
Microsoft Excel Suite
96
top
Returns or sets the top position (in points) of the specified object. Read/write.
top left cell
Returns a range object that represents the cell that lies under the upper-left corner of the
specified object. Read-only.
visible
True if the object is visible. Read/write.
width
Returns or sets an object's width, in points. Read/write.
z order position
Returns the position of the object in the z-order, which corresponds to the object's index
number. Read-only.
Whenever you make a new shape or object, it's added to the front of the z-order by default.
Class: list column
Plural
list columns
Represents a column in a list object.
Use list column index, where index is the list column index number or name, to return a single list
column object. The following example requires that entries added to column 3 of list object 1 be
unique.
set unique of list column 3 of list object 1 of sheet 2 to true
Properties
data type
Returns or sets the data type of the specified column in a list object. Read/write.
Can be one of the following:
no data type
whole number data
decimal data
list data
date data
time data
text data
currency data
calculated data
counter data
default value
Sets a default value for a column in a list object. Read/write.
The default value is an empty string.
name
Returns or sets the name of the object. Read/write.
Microsoft Excel Suite
97
range object
Returns a range object that represents the range to which the specified list column, object, or
row applies. Read-only.
show phonetic fields
True if phonetic fields are visible in a list object column. Read/write.
This property is available only in the Japanese version of Excel or in an English version of
Excel that you have registered as Japanese by using the Microsoft Language Register
application.
unique
True if a list column will accept only new, unique values when records are added or edited.
Read/write.
The default value is false.
Class: list object
Plural
list objects
Elements
list column
list row
Represents a list object on a worksheet.
Use list object index, where index is the list index number or name, to return a single list object
object. The following example converts the second list object on Sheet1 to a normal Excel range.
convert to range list object 2 of sheet "Sheet1"
Properties
cell table
Returns the cell table from a specified list object. Read-only.
name
Returns or sets the name of the object. Read/write.
print field header titles
True if list column labels are reprinted at the top of each page when a list sheet is printed.
Read/write.
query table
Returns a query table object that represents the query table that intersects the specified range.
Read-only.
Microsoft Excel Suite
98
range autoformat
Specifies a predefined format for automatically formatting a range of cells in a list object.
Read/write.
Can be one of the following:
range autoformat threeD effects 1
range autoformat threeD effects 2
range autoformat accounting 1
range autoformat accounting 2
range autoformat accounting 3
range autoformat accounting 4
range autoformat classic 1
range autoformat classic 2
range autoformat classic 3
range autoformat color 1
range autoformat color 2
range autoformat color 3
range autoformat list 1
range autoformat list 2
range autoformat list 3
range autoformat local format 1
range autoformat local format 2
range autoformat local format 3
range autoformat local format 4
range autoformat none
range autoformat simple
range object
Returns a range object that represents the range to which the specified list column, object, or
row applies. Read/write.
show autofilter
True if the AutoFilter is implemented in a list object. Read/write.
total
Specifies that a totals row be implemented in a list object. Read/write.
The default value is false.
total row
Returns the totals row, if any, from a specified list object. Read-only.
used range
Returns a range object that represents the used range on the specified worksheet. Read-only.
visuals
Specifies how, or whether, visuals are displayed in the list object. Read/write.
Can be one of the following:
Constant Description
list object visual
automatic
Turns the visuals on or off depending on whether the list is
currently selected.
list object visual off
Visuals are not displayed in the list object.
list object visual on
Visuals remain displayed in the list object.
Microsoft Excel Suite
99
Class: list row
Plural
list rows
Represents a row in a list object.
Use list row index, where index is the list row index number or name, to return a single list row
object. The following example deletes the 25th row from a list object.
delete range range object of list row 25 of list object 1 of sheet 1
Properties
range object
Returns a range object that represents the range to which the specified list column, object, or
row applies. Read-only.
Class: listbox
Plural
listboxes
Represents a listbox control.
Use listbox index, where index is the entry index number or name, to return a single listbox object.
The following example creates a new listbox.
make new listbox at end of worksheet 1 of workbook 1 with properties
{top:100, left position:100, height:24, width:100}
The following example gets the properties of a listbox object on a worksheet.
get properties of listbox 1 of worksheet 1 of workbook 1
Properties
bottom right cell
Returns a range object that represents the cell that lies under the lower-right corner of the
object. Read-only.
display threeD shading
Returns or sets the 3-D shading for this object. Read/write.
enabled
True if the object is enabled. Read/write.
entry index
Returns the index number of the object within the elements of the parent object. Read-only.
height
Returns or sets the height (in points) of the object. Read/write.
Microsoft Excel Suite
100
left position
Returns or sets the position (in points) of the specified object. Read/write.
linked cell
Returns or sets the worksheet range linked to the control's value. If you place a value in the
cell, the control takes this value. Likewise, if you change the value of the control, that value is
also placed in the cell. Read/write.
You cannot use this property if the multi select property is select simple or select extended.
list fill range
Returns or sets the worksheet range used to fill the specified list box. Setting this property
destroys any existing list in the list box. Read/write.
Excel reads the contents of every cell in the range and inserts the cell values into the list box.
The list tracks changes in the range's cells.
If the list in the list box was created with the add item to list command, this property returns
an empty string ("").
list index
Returns or sets the index number of the currently selected item in a list box or combo box.
Read/write.
You cannot use this property if the multi select property is select simple or select extended.
locked
True if the object is locked; false if the object can be modified when the sheet is protected.
Read/write.
multi select
Returns or sets the selection mode of the specified list box. Read/write.
Can be one of the following:
Value Description
select none
Single select — allows only one item at a time to be selected. Clicking the
mouse or pressing the SPACEBAR cancels the selection and selects the
clicked item.
select simple
Simple multiselect — toggles the selection on an item in the list when you
click it with the mouse or when you press the SPACEBAR while the focus is
on the item. This mode is appropriate for pick lists, in multiple items are
often selected.
select extended
Extended multiselect — usually acts like a single-selection list box, so when
you click an item, you cancel all other selections. When you hold down
SHIFT while clicking the mouse or pressing an arrow key, you select items
sequentially from the current item. When you hold down CTRL while
clicking the mouse, you add single items to the list. This mode is appropriate
when multiple items are allowed but not often used.
To return and set the selected item in a single-select list box, use the value or list index property.
Microsoft Excel Suite
101
name
Returns or sets the name of the object. Read/write.
number of items in list
Returns the total number of items in the list. Read-only.
on action
Returns or sets either the name of a script or VB macro that runs when the specified object is
clicked. AppleScript scripts not saved with the document. Read/write.
placement
Returns or sets the way the object is attached to the cells below it. Read/write.
Can be one of the following:
placement free floating
placement move
placement move and size
print object
True if the object will be printed when the document is printed. Read/write.
top
Returns or sets the top position (in points) of the specified object. Read/write.
top left cell
Returns a range object that represents the cell that lies under the upper-left corner of the
specified object. Read-only.
value
Returns or sets the value of the control. Read/write.
visible
True if the object is visible. Read/write.
width
Returns or sets an object's width, in points. Read/write.
z order position
Returns the position of the object in the z-order, which corresponds to the object's index
number. Read-only.
Whenever you make a new shape or object, it's added to the front of the z-order by default.
Microsoft Excel Suite
102
Class: macro sheet
Plural
macro sheets
Represents a macro sheet.
Use macro sheet index, where index is the macro sheet index number or name, to return a single
macro sheet object. The following example creates a new macro sheet.
make new macro sheet
at the beginning of active workbook
Properties
<Inheritance> sheet
Inherits the properties and elements of the sheet class.
enable selection
Returns or sets what can be selected on the sheet. This property takes effect only when the
worksheet is protected. Read/write.
Can be one of the following:
Value Description
no restrictions
Allows any cell to be selected.
unlocked cells
Allows only those cells whose locked property is false to be selected.
no selection
Prevents any selection on the sheet.
Class: named item
Plural
named items
Represents a defined name for a range of cells. Named items can be either built-in names, such as
Database, Print_Area, and Auto_Open, or custom names.
Use named item index, where index is the name index number or defined name, to return a single
named item object.
The index number indicates the position of the name within the application's internal list of named
items. Named items are placed in alphabetical order, from a to z, and are not case-sensitive (this is
the same order that is displayed in the Define Name and Apply Names dialog boxes when you
click Name on the Insert menu). The following example displays the cell reference for the first name
in the application's internal list of named items.
display dialog references of named item 1
Microsoft Excel Suite
103
The following example deletes the name "mySortRange" from the active workbook.
delete named item "mySortRange" of active workbook
Use the name property to return or set the text of the name itself. The following example changes the
name of the first named item object in the active workbook.
set name of named item 1 to "stock_values"
Properties
category
Returns or sets the category for the specified name. The name must refer to a custom function
or command. Read/write.
category local
Returns or sets the category for the specified name, in the language of the user, if the name
refers to a custom function or command. Read/write.
entry index
Returns the index number of the object within the elements of the parent object. Read-only.
macro type
Returns or sets what the name refers to. Read-write.
Can be one of the following:
Constant Meaning
macro type command
The name refers to a user-defined VB macro.
macro type function
The name refers to a user-defined function.
macro type not XLM
The name doesn't refer to a function or VB macro.
name
Returns or sets the name of the object. Read/write.
name local
Returns or sets the name of the object, in the language of the user. Read/write.
If the style is a built-in style, this property returns the name of the style in the language of the
current locale.
reference local
Returns or sets the formula that the name refers to. The formula is in the language of the user,
and it's in A1-style notation, beginning with an equal sign. Read/write.
reference local r1c1
Returns or sets the formula that the name refers to. This formula is in the language of the user,
and it's in R1C1-style notation, beginning with an equal sign. Read/write.
Microsoft Excel Suite
104
reference r1c1
Returns or sets the formula that the name refers to. The formula is in R1C1-style notation,
beginning with an equal sign. Read/write.
reference range
Returns the range object referred to by a name object. Read-only.
If the name object doesn't refer to a range (for example, if it refers to a constant or a formula),
this property fails.
To change the range that a name refers to, use the reference local property.
references
Returns or sets the formula that the name is defined to refer to, in A1-style notation, beginning
with an equal sign. Read/write
shortcut key
Returns or sets the shortcut key for a name defined as a custom Excel 4.0 macro command.
Read/write.
value
Returns or sets a string containing the formula that the name is defined to refer to. The string is
in A1-style notation and it begins with an equal sign. Read/write.
visible
True if the object is visible. Read/write.
If you set the visible property for a name to false, the name will not appear in the Define Name
dialog box.
Class: ODBC error
Plural
ODBC errors
Represents an ODBC error generated by the most recent ODBC query.
Use ODBC error index, where index is the index number of the error, to return a single ODBC error
object. The following example refreshes query table one and displays the first ODBC error that
occurs.
refresh query table query table 1 of sheet 1
if (count of ODBC errors) > 0 then
set er to ODBC error 1
dialog "The following error occurred:" ¬
& error string of er & " : " & sql state of er
else
dialog "Query complete: all records returned."
end if
Microsoft Excel Suite
105
Properties
error string
Returns the ODBC error string. Read-only.
sql state
Returns the SQL state error. Read-only.
For an explanation of the specific error, see your SQL documentation.
Class: option button
Plural
option buttons
Elements
character
Represents an option button control.
Use option button index, where index is the entry index number or name to return a single option
button object. The following example creates a new option button.
make new option button at end of worksheet 1 of workbook 1 with properties
{top:100, left position:100, height:24, width:100}
The following example gets the properties of an option button object on a worksheet.
get properties of option button 1 of worksheet 1 of workbook 1
Properties
accelerator
Returns or sets the accelerator character for this control. Read/write.
border
Returns a border object that represents the border of the object. Read-only.
bottom right cell
Returns a range object that represents the cell that lies under the lower-right corner of the
object. Read-only.
caption
Returns or sets the caption for this object. Read/write.
control text
Returns or sets the default text for the control. Read/write.
display threeD shading
Returns or sets the 3-D shading for this object. Read/write.
enabled
True if the object is enabled. Read/write.
Microsoft Excel Suite
106
entry index
Returns the index number of the object within the elements of the parent object. Read-only.
group box
Returns a group box object that represents the grouping of the object. Read-only.
height
Returns or sets the height (in points) of the object. Read/write.
interior object
Returns an interior object that represents the interior of the specified object. Read-only.
left position
Returns or sets the position (in points) of the specified object. Read/write.
linked cell
Returns or sets the worksheet range linked to the control's value. If you place a value in the
cell, the control takes this value. Likewise, if you change the value of the control, that value is
also placed in the cell. Read/write.
locked
True if the object is locked; false if the object can be modified when the sheet is protected.
Read/write.
locked text
True if the text in the specified object will be locked to prevent changes when the workbook is
protected. Read/write.
name
Returns or sets the name of the object. Read/write.
on action
Returns or sets either the name of a script or VB macro that runs when the specified object is
clicked. AppleScript scripts are not saved with the document. Read/write.
phonetic accelerator
This property is not currently supported.
placement
Returns or sets the way the object is attached to the cells below it. Read/write.
Can be one of the following:
placement free floating
placement move
placement move and size
print object
True if the object will be printed when the document is printed. Read/write.
Microsoft Excel Suite
107
top
Returns or sets the top position (in points) of the specified object. Read/write.
top left cell
Returns a range object that represents the cell that lies under the upper-left corner of the
specified object. Read-only.
value
Returns or sets the value of the control. Read/write.
visible
True if the object is visible. Read/write.
width
Returns or sets an object's width, in points. Read/write.
z order position
Returns the position of the object in the z-order, which corresponds to the object's index
number. Read-only.
Whenever you make a new shape or object, it's added to the front of the z-order by default.
Class: outline
Plural
outlines
Represents an outline on a worksheet.
Use the outline object property to return an outline object. The following example sets the outline on
Sheet4 so that only the first outline level is shown.
show levels (outline object of sheet "Sheet4") row levels 1
Properties
automatic styles
True if the outline uses automatic styles. Read/write.
summary column
Returns or sets the location of the summary columns in the outline, as shown in the following
table. Read/write.
Value Meaning
summary on left
The summary column will be positioned to the left of the detail
columns in the outline.
summary on right
The summary column will be positioned to the right of the detail
columns in the outline.
Microsoft Excel Suite
108
summary row
Returns or sets the location of the summary rows in the outline, as shown in the following
table. Read/write.
Value Meaning
summary above
The summary row will be positioned above the detail rows in the
outline. Use for Microsoft Word-style outlines, where category
headers are above the detailed information.
summary below
The summary row will be positioned below the detail rows in the
outline. Use for accounting-style outlines, where summations are
below the detailed information.
Class: page field
Plural
page fields
Represents a page field in a PivotTable report.
Use page field index, where index is the page field's name or index number, to return a single page
field object.
This example adds the page field names to a list on a new worksheet.
set nwSheet to make new worksheet
activate object nwSheet
set pvtTable to pivot table of range "A1" of worksheet "Sheet2"
set rw to 0
repeat with pvtField in (get page fields of pvtTable)
set rw to rw + 1
set value of cell rw of column 1 of nwSheet to (get name of pvtField)
end repeat
Properties
<Inheritance> pivot field
Inherits the properties and elements of the pivot field class.
Microsoft Excel Suite
109
Class: page setup
Plural
page setups
Represents the page setup description. The page setup object contains all page setup attributes (left
margin, bottom margin, paper size, and so on) as properties.
Use the page setup object property to return a page setup object. The following example sets the
orientation to landscape mode and then prints the worksheet.
set page orientation of page setup object ¬
of sheet 1 of active workbook to landscape
print out worksheet 1
The following special formatting codes can be included as a part of the header and footer properties
(left header, center header, right header, left footer, center footer, right footer).
Format code Description
&L Left aligns the characters that follow.
&C Centers the characters that follow.
&R Right aligns the characters that follow.
&E Turns double-underline printing on or off.
&X Turns superscript printing on or off.
&Y Turns subscript printing on or off.
&B Turns bold printing on or off.
&I Turns italic printing on or off.
&U Turns underline printing on or off.
&S Turns strikethrough printing on or off.
&O Turns outline printing on or off (Macintosh only).
&H Turns shadow printing on or off (Macintosh only).
&D Prints the current date.
&T Prints the current time.
&F Prints the name of the document.
&A Prints the name of the workbook tab.
&P Prints the page number.
&Z Prints the path of the document.
&G Includes a picture.
Microsoft Excel Suite
110
Format code Description
&P+number Prints the page number plus the specified number.
&P-number Prints the page number minus the specified number.
&& Prints a single ampersand.
& "fontname" Prints the characters that follow in the specified font. Be sure to include the double
quotation marks.
&nn Prints the characters that follow in the specified font size. Use a two-digit number to
specify a size in points.
&N Prints the total number of pages in the document.
Properties
black and white
True if elements of the document will be printed in black and white. Read/write.
This property applies only to worksheets.
bottom margin
Returns or sets the size (in points) of the bottom margin. Read/write.
Margins are set or returned in points. Use either the inches to points command or the
centimeters to points command to do the conversion. For example:
set bottom margin of page setup object of sheet 1 ¬
of active workbook to (inches to points inches 0.5)
center footer
Returns or sets the center part of the footer. Read/write.
Special format codes can be used in the footer text.
center footer picture
Returns a graphic object that represents the picture for the center section of the footer. Used to
set attributes about the picture.
The center footer picture property is read-only, but not all of its properties are read-only.
center header
Returns or sets the center part of the header. Read/write.
Special format codes can be used in the footer text.
center header picture
Returns a graphic object that represents the picture for the center section of the header. Used
to set attributes about the picture.
The center header picture property is read-only, but not all of its properties are read-only.
Microsoft Excel Suite
111
center horizontally
True if the sheet is centered horizontally on the page when it's printed. Read/write.
center vertically
True if the sheet is centered vertically on the page when it's printed. Read/write.
chart size
Returns or sets the way a chart is scaled to fit on a page. Read/write.
Can be one of the following:
Value Description
full screen
Prints the chart the same size as it appears on the screen.
fit to page
Prints the chart as large as possible, while retaining the chart's height-to-width
ratio as shown on the screen.
full page
Prints the chart to fit the page, adjusting the height-to-width ratio as necessary.
This property applies only to chart sheets (it cannot be used with embedded charts).
draft
True if the sheet will be printed without graphics. Read/write.
Setting this property to true makes printing faster (at the expense of not printing graphics).
first page number
Returns or sets the first page number that will be used when this sheet is printed. If this
property is omitted, Excel chooses the first page number automatically. Read/write.
fit to pages tall
Returns or sets the number of pages tall the worksheet will be scaled to when it's printed. This
property applies only to worksheets. Read/write.
If this property is false, Excel scales the worksheet according to the fit to pages wide property.
If the zoom property is true, the fit to pages tall property is ignored.
fit to pages wide
Returns or sets the number of pages wide the worksheet will be scaled to when it's printed.
This property applies only to worksheets. Read/write.
If this property is false, Excel scales the worksheet according to the fit to pages wide property.
If the zoom property is true, the fit to pages wide property is ignored.
footer margin
Returns or sets the distance (in points) from the bottom of the page to the footer. Read/write.
Microsoft Excel Suite
112
header margin
Returns or sets the distance (in points) from the top of the page to the header. Read/write.
Margins are set or returned in points. Use the inches to points command or the centimeters to
points command to convert measurements from inches or centimeters.
left footer
Returns or sets the left part of the footer. Read/write.
Special format codes can be used in the footer text.
left footer picture
Returns a graphic object that represents the picture for the left section of the footer. Used to set
attributes about the picture.
The left footer picture property is read-only, but not all of its properties are read-only.
left header
Returns or sets the left part of the header. Read/write.
Special format codes can be used in the header text.
left header picture
Returns a graphic object that represents the picture for the left section of the header. Used to
set attributes about the picture.
The left header picture property is read-only, but not all of its properties are read-only.
left margin
Returns or sets the size (in points) of the left margin. Read/write.
Margins are set or returned in points. Use the inches to points command or the centimeters to
points command to convert measurements from inches or centimeters.
order
Returns or sets the order that Excel uses to number pages when printing a large worksheet.
This property applies only to worksheets. Read/write.
Can be one of the following:
down then over
over then down
page orientation
Returns or sets the page's orientation. Read-write.
Can be one of the following:
landscape
portrait
Microsoft Excel Suite
113
print Excel comments
Returns or sets the way comments are printed with the sheet. Read/write.
Can be one of the following:
print sheet end
print in place
print no comments
print area
Returns or sets the range to be printed as a string using A1-style references. Read/write.
To set the print area to the entire sheet, set this property to false or to the empty string ("").
This property applies only to worksheets.
print gridlines
True if cell gridlines are printed on the page. This property applies only to worksheets.
Read/write.
print headings
True if row and column headings are printed with this page. This property applies only to
worksheets. Read/write.
The display headings property controls the on-screen display of headings.
print notes
True if cell notes are printed as end notes with the sheet. This property applies only to
worksheets. Read/write.
Use the print comments property to print comments as text boxes or end notes.
print quality
Returns or sets a two-element list where 1 is the horizontal print quality and 2 is the vertical
print quality. Read/write.
Some printers may not support vertical print quality. If you don't specify this argument, the
print quality command returns (or can be set to) a list that contains both horizontal and
vertical print quality.
This example sets print quality on a printer with nonsquare pixels. The list specifies both
horizontal and vertical print quality. This example may cause an error, depending on the
printer driver you're using.
set print quality of page setup object ¬
of sheet 1 of active workbook to {240, 140}
print title columns
Returns or sets the columns that contain the cells to be repeated on the left side of each page,
as a string in A1-style notation. Read/write.
If you specify only part of a column or columns, Excel expands the range to full columns.
To turn off title columns, set this property to false or to the empty string ("").
This property applies only to worksheets.
Microsoft Excel Suite
114
print title rows
Returns or sets the rows that contain the cells to be repeated at the top of each page, as a string
in A1-style notation. Read/write.
If you specify only part of a row or rows, Excel expands the range to full rows.
To turn off title rows, set this property to false or to the empty string ("").
This property applies only to worksheets.
right footer
Returns or sets the right part of the footer. Read/write.
Special format codes can be used in the footer text.
right footer picture
Returns a graphic object that represents the picture for the right section of the footer. Used to
set attributes of the picture.
The right footer picture property is read-only, but not all of its properties are read-only.
right header
Returns or sets the right part of the header. Read/write.
Special format codes can be used in the header text.
right header picture
Returns a graphic object that represents the picture for the right section of the header. Used to
set attributes about the picture.
The right header picture property is read-only, but not all of its properties are read-only.
right margin
Returns or sets the size (in points) of the right margin. Read/write.
Margins are set or returned in points. Use the inches to points command or the centimeters to
points command to convert measurements from inches or centimeters.
top margin
Returns or sets the size (in points) of the top margin. Read/write.
Margins are set or returned in points. Use the inches to points command or the centimeters to
points command to convert measurements from inches or centimeters.
zoom
Returns or sets a percentage (between 10 and 400 percent) by which Excel will scale the
worksheet for printing. This property applies only to worksheets. Read/write.
If this property is false, the fit to pages wide and fit to pages tall properties control how the
worksheet is scaled.
All scaling retains the aspect ratio of the original document.
Microsoft Excel Suite
115
Class: pane
Plural
panes
Represents a pane of a window. Please note that pane objects exist only for worksheets and Excel 4.0
macro sheets.
Use pane index, where index is the pane index number, to return a single pane object. The following
example splits the window in which worksheet one is displayed and then scrolls through the pane
in the lower-left corner until row five is at the top of the pane.
activate sheet 1
set split of active window to true
set scroll row of pane 3 of active window to 5
Properties
entry index
Returns the index number of the object within the elements of the parent object. Read-only.
scroll column
Returns or sets the number of the leftmost column in the pane or window. Read/write.
If the window is split, the scroll column property of the window object refers to the upper-left
pane. If the panes are frozen, the scroll column property of the window object excludes the
frozen areas.
scroll row
Returns or sets the number of the row that appears at the top of the pane or window.
Read/write.
If the window is split, the scroll row property of the window object refers to the upper-left
pane. If the panes are frozen, the scroll row property of the window object excludes the frozen
areas.
visible range
Returns a range object that represents the range of cells that are visible in the window or pane.
If a column or row is partially visible, it's included in the range. Read-only.
Class: parent item
Plural
parent items
Represents a parent item in a PivotTable report.
Use parent item index, where index is the parent item's name or index number, to return a single
parent item object. This example creates a list containing the names of all the items that are group
parents in the field named "product."
Microsoft Excel Suite
116
set nwSheet to make new worksheet
activate object nwSheet
set pvtTable to pivot table of range "A1" of worksheet "Sheet2"
set rw to 0
repeat with pvtItem in (get parent items of pivot field "product" of pvtTable)
set rw to rw + 1
set value of cell rw of column 1 of nwSheet to (get name of pvtItem)
end repeat
Properties
<Inheritance> pivot item
Inherits the properties and elements of the pivot item class.
Class: phonetic
Plural
phonetics
Contains information about a specific phonetic text string in a cell.
Use phonetic index, where index is the index number of the phonetic text, to return a single phonetic
object.
Use the phonetic object property of the range class to return or set the attributes of phonetic text in a
specified range.
This example gets the phonetic text of the phonetic object in cell A4.
get phonetic text of phonetic object of range "A4"
Properties
character type
Returns or sets the type of phonetic text in the specified cell. Read/write.
Can be one of the following:
phonetic character half width katakana
phonetic character full width katakana
phonetic character hiragana
no phonetic character conversion
font object
Returns the font object that represents the font of the specified object. Read-only.
Microsoft Excel Suite
117
phonetic alignment
Returns or sets the alignment for the specified phonetic text. Read/write.
Can be one of the following:
phonetic align no control
phonetic align left
phonetic align center
phonetic align distributed
phonetic text
Returns or sets the text for the specified object. Read/write.
visible
Returns or sets if the object is visible. Read/write.
Class: pivot cache
Plural
pivot caches
Represents the memory cache for a PivotTable report.
Use the pivot cache property to return a pivot cache object for a PivotTable report (each PivotTable
report has only one cache). The following example causes the first PivotTable report on worksheet 1
to refresh itself whenever the workbook is opened.
set refresh on file open of pivot cache of pivot table 1 of worksheet 1 to true
Use pivot cache index, where index is the cache number, to return a single pivot cache object from
the list of pivot cache objects for a workbook. The following example refreshes cache 1.
refresh pivot cache 1 of active workbook
Properties
SQL query
Returns or sets the SQL query string used with the specified ODBC data source. Read/write.
This property supports the full ODBC Data Manipulation Language (DML) grammar,
including wild card characters, and stored procedures that return data. This property doesn't
support Data Definition Language (DDL) statements.
You should use the command text property instead of the SQL query property, which now exists
primarily for compatibility with earlier versions of Excel. If you use both properties, the value
for the command text property takes precedence.
For ODBC sources, the command text property functions exactly like the SQL query property,
and setting the property causes the data to be refreshed.
background query
True if queries for the PivotTable report or query table are performed asynchronously (in the
background). Read/write.
Microsoft Excel Suite
118
command text
Returns or sets the command string for the specified data source. Read/write.
You should use the command text property instead of the SQL query property, which now exists
primarily for compatibility with earlier versions of Excel. If you use both properties, the value
for the command text property takes precedence.
For ODBC sources, the command text property functions exactly like the SQL query property,
and setting the property causes the data to be refreshed.
connection
Returns or sets a string that contains one of the following: ODBC settings that enable you to
connect to an ODBC data source; a URL that enables Excel to connect to a Web data source; or
a file that specifies a database or Web query. Read/write.
Setting the connection property doesn't immediately initiate the connection to the data source.
You must use the refresh command to make the connection and retrieve the data.
enable refresh
True if the PivotTable cache or query table can be refreshed by the user. The default value is
true. Read/write.
The refresh on file open property is ignored if the enable refresh property is set to false.
entry index
Returns the index number of the object within the elements of the parent object. Read-only.
memory used
Returns the amount of memory (in bytes) that Excel is currently using. Read-only.
optimize cache
True if the PivotTable cache is optimized when it's constructed. The default value is false.
Read/write.
Cache optimization results in additional queries and degrades initial performance of the
PivotTable report.
record count
Returns the number of records in the PivotTable cache or the number of cache records that
contain the specified item. Read-only.
refresh date
Returns the date on which the PivotTable report or pivot cache was last refreshed. Read-only.
refresh name
Returns the name of the person who last refreshed the PivotTable data or pivot cache. Read-
only.
refresh on file open
True if the PivotTable cache or query table is automatically updated each time the workbook is
opened. The default value is false. Read/write.
Query tables and PivotTable reports are not automatically refreshed when you open the
workbook by using the open command. To refresh the data after the workbook is open, use
the refresh command.
Microsoft Excel Suite
119
save password
True if password information in an ODBC connection string is saved with the specified query.
False if the password is removed. Read/write.
This property affects only ODBC queries.
source data
Returns or sets the data source for the PivotTable report. Read/write.
Can be one of the following:
range object
A1-style range reference
named range
list of strings
Class: pivot field
Plural
pivot fields
Elements
child item
hidden item
parent item
pivot item
calculated item
Represents a field in a PivotTable report.
Use pivot field index, where index is the name or index number of the pivot field, to return a single
pivot field object. The following example makes the pivot field named "Year" a row field in the first
PivotTable report on Sheet3.
set pivot field orientation of pivot field "Year" ¬
of pivot table 1 of worksheet "Sheet3" ¬
to orient as row field
Microsoft Excel Suite
120
Properties
auto show count
Returns the number of top or bottom items that are automatically shown in the pivot field.
Read-only.
auto show field
Returns the name of the data field used to determine the top or bottom items that are
automatically shown in the pivot field. Read-only.
auto show range
Returns position top if the top items are shown automatically in the pivot field; returns
position bottom if the bottom items are shown. Read-only.
auto show type
Returns type_automatic if AutoShow is enabled for the pivot field; returns type_manual if
AutoShow is disabled. Read-only.
auto sort field
Returns the name of the data field used to sort the pivot field automatically. Read-only.
auto sort order
Returns the order used to sort the pivot field automatically. Read-only.
Can be one of the following:
sort ascending
sort descending
sort manual (if automatic sorting is disabled)
base field
Returns or sets the base field for a custom calculation. Valid only for data fields. Read/write.
base item
Returns or sets the item in the base field for a custom calculation. Valid only for data fields.
Read/write.
Microsoft Excel Suite
121
calculation
Returns or sets the type of calculation done by the specified pivot field. Valid only for data
fields. Read/write.
Can be one of the following:
pivot field calculation difference from
pivot field calculation index
pivot field calculation no additional calculation
pivot field calculation percent difference from
pivot field calculation percent of
pivot field calculation percent of column
pivot field calculation percent of row
pivot field calculation percent of total
pivot field calculation running total
child field
Returns a pivot field object that represents the child pivot field for the specified field (if the
field is grouped and has a child field). Read-only.
If the specified field has no child field, this property causes an error.
current page
Returns or sets the current page showing for the page field. This property is valid only for
page fields. Read/write.
To set this property, set it to the name of the page. Set it to all to set all pages that are showing.
data range
Returns a range object. For a data field, the range is the data contained in the field. For a row,
column, or page field, the range is the items in the field. For items, the range is the data
qualified by the item. Read-only.
drag to column
True if the pivot field can be dragged to the column position. The default value is true.
Read/write.
drag to data
True if the specified field can be dragged to the data position. The default value is true.
Read/write.
drag to hide
True if the field can be hidden by being dragged off the PivotTable report. The default value is
true. Read/write.
Microsoft Excel Suite
122
drag to page
True if the field can be dragged to the page position. The default value is true. Read/write.
drag to row
True if the field can be dragged to the row position. The default value is true. Read/write.
formula
Returns or sets the object's formula in A1-style notation. Read/write.
If the cell contains a constant, this property returns the constant. If the cell is empty, formula
returns an empty string. If the cell contains a formula, formula returns the formula as a string,
in the same format in which it would be displayed in the formula bar (including the equal
sign).
If you set the value or formula of a cell to a date, Excel checks to see whether that cell is
already formatted with one of the date or time number formats. If not, Excel changes the
number format to the default short date number format.
If the range is a one- or two-dimensional range, you can set the formula to an array formula of
the same dimensions. Similarly, you can put the formula into a list.
Setting the formula for a multiple-cell range fills all cells in the range with the formula.
function
Returns or sets the function used to summarize the pivot field (data fields only). Read/write.
Can be one of the following:
do average
do count numbers
do maximum
do minimum
do product
do standard deviation
do standard deviation p
do sum
do var
do var p
group level
Returns the placement of the specified field within a group of fields (if the field is a member of
a grouped set of fields). Read-only.
The highest-level parent field (leftmost parent field) is level one, its child is level two, and so
on.
is calculated
True if the pivot field or item is a calculated field or item. Read-only.
label range
Returns a range object that represents the cell (or cells) that contain the field label. Read-only.
memory used
Returns the amount of memory (in bytes) currently being used by the object. Read-only.
Microsoft Excel Suite
123
name
Returns or sets the name of the object. Read/write.
number format
Returns or sets the format code for the object. If all cells in the specified range do not have the
same number format, returns missing value. Read/write.
For the pivot field object, you can set the number format property only for a data field.
The format code is the same string as the Format Codes option in the Format Cells dialog box.
The format function uses different format code strings than do the number format and number
format local properties.
parent field
Returns a pivot field object that represents the pivot field that's the group parent of the object.
The field must be grouped and have a parent field. Read-only.
pivot field data type
Returns a constant describing the type of data in the pivot field. Read-only.
Can be one of the following:
pivot field type date
pivot field type number
pivot field type text
pivot field orientation
Returns or sets the location of the field in the PivotTable report. Read/write.
Can be one of the following:
orient as column field
orient as data field
orient as hidden
orient as page field
orient as row field
position
Returns or sets the position of the field (first, second, third, and so on) among all the fields in
its orientation (rows, columns, pages, data). Read/write.
Microsoft Excel Suite
124
server based
True if the PivotTable report's data source is external and only the items matching the page
field selection are retrieved. Read/write.
When this property is true, only records in the database that match the selected page field item
are retrieved. From then on, whenever the user changes the page field selection, the newly
selected page field item is passed to the query as a parameter, and the cache is refreshed.
This property cannot be set if any of the following conditions are true:
The field is grouped.
The data source isn't external.
The cache is shared by two or more PivotTable reports.
The field is a data type that cannot be server based (a memo field or an OLE object).
show all items
True if all items in the PivotTable report are displayed, even if they don't contain summary
data. The default value is false. Read/write.
source name
Returns the specified object's name, as it appears in the original source data for the PivotTable
report. This might be different from the current item name if the user renamed the item after
creating the PivotTable report. Read-only.
total levels
Returns the total number of fields in the current field group. If the field is not grouped, the
total levels property returns the value 1. Read-only.
All fields in a set of grouped fields have the same total levels value.
value
Returns or sets the name of the specified field in the PivotTable report. Read/write.
visible items
Returns an object that represents either a single visible pivot item (a pivot item object) or a list
of all the visible pivot items (a pivot items object) in the specified field. Read-only.
Class: pivot formula
Plural
pivot formulas
Represents a formula used to calculate results in a PivotTable report.
Use pivot formula index, where index is the formula number or string on the left side of the pivot
formula, to return the pivot formula object. The following example changes the index number for
formula one so that it will be solved after formula two.
set entry index of pivot formula 1 of pivot table 1 of worksheet 1 to 2
Microsoft Excel Suite
125
Properties
entry index
Returns the index number of the object within the elements of the parent object. Read-only.
formula
Returns or sets the object's formula in A1-style notation. Read/write.
If the cell contains a constant, this property returns the constant. If the cell is empty, formula
returns an empty string. If the cell contains a formula, formula returns the formula as a string,
in the same format in which it would be displayed in the formula bar (including the equal
sign).
If you set the value or formula of a cell to a date, Excel checks to see whether that cell is
already formatted with one of the date or time number formats. If not, Excel changes the
number format to the default short date number format.
If the range is a one- or two-dimensional list, you can set the formula to an array formula of
the same dimensions. Similarly, you can put the formula into a list.
Setting the formula for a multiple-cell range fills all cells in the range with the formula.
value
Returns or sets the name of the specified formula in the PivotTable report. Read/write.
Class: pivot item
Plural
pivot items
Elements
child item
Represents an item in a pivot field. The items are the individual data entries in a field category.
Use pivot item index, where index is the pivot item index number or name, to return a single pivot
item object. The following example hides all entries in the first PivotTable report on Sheet3 that
contain "1998" in the "Year" pivot field.
set visible of pivot item "1998" of pivot field "Year" of pivot table 1 ¬
of worksheet "Sheet3" to false
Properties
data range
Returns a range object as shown in the following table. For a data field, the range is the data
contained in the field. For a row, column, or page field, the range is the items in the field. For
items, the range is the data qualified by the item. Read-only.
Microsoft Excel Suite
126
formula
Returns or sets the object's formula in A1-style notation. Read/write.
If the cell contains a constant, this property returns the constant. If the cell is empty, formula
returns an empty string. If the cell contains a formula, formula returns the formula as a string,
in the same format in which it would be displayed in the formula bar (including the equal
sign).
If you set the value or formula of a cell to a date, Excel checks to see whether that cell is
already formatted with one of the date or time number formats. If not, Excel changes the
number format to the default short date number format.
If the range is a one- or two-dimensional list, you can set the formula to an array formula of
the same dimensions. Similarly, you can put the formula into a list.
Setting the formula for a multiple-cell range fills all cells in the range with the formula.
is calculated
True if the pivot field or item is a calculated field or item. Read-only.
label range
Returns a range object that represents the cell (or cells) that contain the field label. Read-only.
name
Returns or sets the name of the object. Read/write.
parent item
Returns a pivot item object that represents the parent pivot item in the parent pivot field
object (the field must be grouped so that it has a parent). Read-only.
parent show detail
True if the specified item is showing because one of its parents is showing detail. False if the
specified item isn't showing because one of its parents is hiding detail. This property is
available only if the item is grouped. Read-only.
position
Returns or sets the position of the item in its field, if the item is currently showing.
Read/write.
record count
Returns the number of records in the PivotTable cache or the number of cache records that
contain the specified item. Read-only.
show detail
True if the pivot item is showing detail. Read/write.
If the specified range is in a PivotTable report, it's possible to set this property for more than
one cell at a time if the range is contiguous. This property can be returned only if the range is a
single cell.
Microsoft Excel Suite
127
source name
Returns the name of the specified object, as it appears in the original source data for the
PivotTable report. This might be different from the name of the current item if the user
renamed the item after creating the PivotTable report. Read-only.
value
Returns or sets the name of the specified item in the PivotTable report. Read/write.
visible
True if the item is currently visible in the table. Read/write.
Class: pivot table
Plural
pivot tables
Elements
column field
data field
hidden field
page field
pivot field
row field
calculated field
pivot formula
Represents a PivotTable report on a worksheet.
Use pivot table index, where index is the PivotTable index number or name, to return a single pivot
table object. The following example makes the pivot field named "Year" a row field in the first
PivotTable report on Sheet3.
set pivot field orientation of pivot field "Year" ¬
of pivot table 1 of worksheet "Sheet3" ¬
to orient as row field
Properties
cache index
Returns or sets the index number of the PivotTable cache. Read/write.
If you set the cache index property so that one PivotTable report uses the cache for a second
PivotTable report, the first PivotTable report's fields must be a valid subset of the fields in the
second PivotTable report.
column grand
True if the PivotTable report shows grand totals for columns. Read/write.
Microsoft Excel Suite
128
column range
Returns a range object that represents the range that contains the PivotTable column area.
Read-only.
data body range
Returns a range object that represents the range that contains the PivotTable data area. Read-
only.
data label range
Returns a range object that represents the range that contains the labels for the PivotTable data
fields. Read-only.
display error string
True if the PivotTable report displays a custom error string in cells that contain errors. The
default value is false. Read/write.
To set the custom error string, use the error string property.
This property is particularly useful for suppressing divide-by-zero errors when calculated
fields are pivoted.
display null string
True if the PivotTable report displays a custom string in cells that contain null values. The
default value is true. Read/write.
To set the custom null string, use the null string property.
enable drilldown
True if drilldown is enabled. The default value is true. Read/write.
Setting this property for a PivotTable report sets it for all fields in that PivotTable report.
enable field dialog
True if the PivotTable Field dialog box is available when the user double-clicks the PivotTable
field. The default value is true. Read/write.
Setting this property for a PivotTable report sets it for all fields in that PivotTable report.
enable wizard
True if the PivotTable Wizard is available. The default value is true. Read/write.
error string
Returns or sets the string displayed in cells that contain errors when the display error string
property is true. The default value is an empty string (""). Read/write.
has autoformat
True if the PivotTable report is automatically formatted when it's refreshed or when fields are
moved. Read/write.
inner detail
Returns or sets the name of the field that will be shown as detail when the show detail property
is true for the innermost row or column field. Read/write.
Microsoft Excel Suite
129
manual update
True if the PivotTable report is recalculated only at the user's request. The default value is
false. Read/write.
merge labels
True if PivotTable outer-row item, column item, subtotal, and grand total labels use merged
cells. Read-write.
name
Returns or sets the name of the object. Read/write.
null string
Returns or sets the string displayed in cells that contain null values when the display null string
property is true. The default value is an empty string (""). Read/write.
page field order
Returns or sets the order in which page fields are added to the PivotTable layout. Read/write.
Can be one of the following:
down then over
over then down
page field style
Returns or sets the style used in the bound page field area. The default value is a null string (no
style is applied by default). Read/write.
This style is used as the default style for the background area, and it's applied before any user
formatting. Cells vacated when a field is pivoted from the page field area to another location
retain this style.
page field wrap count
Returns or sets the number of PivotTable page fields in each column or row. Read/write.
page range
Returns a range object that represents the range that contains the PivotTable page area. Read-
only.
page range cells
Returns a range object that represents the cells in the PivotTable report containing only the
page fields and item drop-down lists. Read-only.
pivot cache
Returns a pivot cache object that represents the cache for the specified PivotTable report.
Read-only.
Microsoft Excel Suite
130
pivot selection
Returns or sets the PivotTable selection, in standard PivotTable selection format. Read/write.
Setting this property is equivalent to calling the pivot select command with the mode argument
set to selection mode data and label.
Standard PivotTable selection format is a string expression used to specify part of a
PivotTable report. You can refer to a particular cell only if the PivotTable selection string
contains the names of all the items used to identify individual cells in the selection. The
number of items in that string should be equal to the number of fields in the view for a cell in a
normal data area. If the cell is used in calculating a subtotal or grand total, the number of items
in the string would be fewer (including 0 [zero] for the intersection of the column and row
grand totals).
The item names in the string can appear in any order. If an item name is ambiguous because it
appears in another field as well, it must be qualified by "Field[Item]." If an item name contains
symbols and spaces, or if it doesn't start with an alphabetical character, it should be enclosed
in single quotation marks. If an item name contains embedded single quotation marks, each of
these marks must be converted to two single quotation marks. Quotation marks aren't
required for spaces if the name is unambiguous, and they're not required for unqualified
names that begin with numbers.
preserve formatting
True if PivotTable formatting is preserved when the PivotTable report is refreshed or
recalculated by operations such as pivoting, sorting, or changing page field items. Read/write.
refresh date
Returns the date on which the PivotTable report or pivot cache was last refreshed. Read-only.
refresh name
Returns the name of the person who last refreshed the PivotTable data or pivot cache. Read-
only.
row grand
True if the PivotTable report shows grand totals for rows. Read/write.
row range
Returns a range object that represents the range including the PivotTable row area. Read-only.
save data
True if data for the PivotTable report is saved with the workbook; false if only the PivotTable
definition is saved. Read/write.
Microsoft Excel Suite
131
selection mode
Returns or sets the PivotTable structured selection mode. Read/write.
Can be one of the following:
selection mode label only
selection mode data and label
selection mode data only
selection mode origin
selection mode button
selection mode blanks
small grid
True if Excel uses a grid that's two cells wide and two cells deep for a newly created
PivotTable report. False if Excel uses a blank stencil outline. Read/write.
You should use the stencil outline. The grid is provided only because it enables compatibility
with earlier versions of Excel.
source data
Returns or sets the data source for the PivotTable report. Read/write.
Can be one of the following:
range object
A1-style range reference
named range
list of strings
subtotal hidden page items
True if hidden page field items in the PivotTable report are included in row and column
subtotals, block totals, and grand totals. The default value is false. Read/write.
table range1
Returns a range object that represents the range containing the entire PivotTable report, but
doesn't include page fields. Read-only.
The table range2 property includes page fields.
table range2
Returns a range object that represents the range containing the entire PivotTable report,
including page fields. Read-only.
The table range1 property doesn't include page fields.
Microsoft Excel Suite
132
table style
Returns or sets the style used in the PivotTable body. The default value is a null string (no style
is applied by default). Read/write.
This style is used as the default style for the background area, and it's applied before any user
formatting.
tag
Returns or sets a string saved with the PivotTable report. Read/write.
vacated style
Returns or sets the style applied to cells vacated when the PivotTable report is refreshed. The
default value is a null string (no style is applied by default). Read/write.
value
Returns or sets the name of the PivotTable report. Read/write.
Class: query table
Plural
query tables
Represents a worksheet table built from data returned from an external data source, such as a SQL
server or a Microsoft Access database.
Use query table index, where index is the index number of the query table, to return a single query
table object. The following example sets query table one so that formulas to the right of it are
automatically updated whenever it's refreshed.
set fill adjacent formulas of query table 1 ¬
of sheet "Sheet1" to true
Properties
FileMaker fields
Returns or sets a list of the field names used in a FileMaker database. Read/write.
To set values for this property, assign them by using a list in the form
{"field name",
"layout number", "field name", "layout number",...}
, alternately specifying a field
name and layout number used in the FileMaker database. The number represents the layout
from which the field derives. In most cases this value is 0 (zero), designating the layout that
contains all the fields.
FileMaker num criteria
Returns or sets the number of criteria used in an Excel query table that has been created to run
against a FileMaker database. Read/write.
adjust column width
True if the column widths are automatically adjusted for the best fit each time you refresh a
query table. False if the column widths aren't automatically adjusted with each refresh. The
default value is true. Read/write.
The maximum column width is two-thirds the width of the screen.
Microsoft Excel Suite
133
background query
True if queries for the PivotTable report or query table are performed asynchronously (in the
background). Read/write.
connection
Returns or sets a string that contains one of the following: ODBC settings that enable Excel to
connect to an ODBC data source, a URL that enables Excel to connect to a Web data source, or
a file that specifies a database or Web query. Read/write.
Setting the connection property doesn't immediately initiate the connection to the data source.
You must use the refresh query table command to make the connection and retrieve the data.
destination
Returns the cell in the upper-left corner of the query table destination range (the range where
the resulting query table will be placed). The destination range must be on the worksheet that
contains the query table object. Read-only.
enable editing
True if the user can edit the specified query table. False if the user can only refresh the query
table. Read/write.
enable refresh
True if the PivotTable cache or query table can be refreshed by the user. The default value is
true. Read/write.
The refresh on file open property is ignored if the enable refresh property is set to false.
fetched row overflow
True if the number of rows returned by the last use of the refresh query table command is
greater than the number of rows available on the worksheet. Read-only.
field names
True if field names from the data source appear as column headings for the returned data. The
default value is true. Read/write.
fill adjacent formulas
True if formulas to the right of the specified query table are automatically updated whenever
the query table is refreshed. Read/write.
has autoformat
True if the PivotTable report is automatically formatted when it's refreshed or when fields are
moved. Read/write.
name
Returns or sets the name of the object. Read/write.
post text
Returns or sets the string used with the post method of inputting data into a Web server to
return data from a Web query. Read/write.
Excel includes sample Web queries that you can modify by changing the HTML code by using
a text editor. You can find these samples in the Microsoft Office 2004/Office/Queries folder.
Microsoft Excel Suite
134
query type
Returns one of the following constants indicating the type of query used by Excel to populate
the query table or PivotTable cache: ODBC query, DAO record set, web query, OLE DB
query, text import, or ADO recordset. Read-only.
You specify the data source in the prefix for the value of the connection property.
refresh on file open
True if the PivotTable cache or query table is automatically updated each time the workbook is
opened. The default value is false. Read/write.
Query tables and PivotTable reports are not automatically refreshed when you open the
workbook by using the Open command (File menu). To refresh the data after the workbook is
open, use the refresh all command.
refresh style
Returns or sets the way rows on the specified worksheet are added or deleted to accommodate
the number of rows in a recordset returned by a query. Read/write. Can be one of the
following:
Value Description
overwrite cells
No new cells or rows are added to the worksheet. Data in surrounding
cells is overwritten to accommodate any overflow.
insert delete cells
Partial rows are inserted or deleted to match the exact number of rows
required for the new recordset.
insert entire rows
Entire rows are inserted, if necessary, to accommodate any overflow. No
cells or rows are deleted from the worksheet.
refreshing
True if there's a background query in progress for the specified query table. Read-only.
To cancel background queries, use the cancel refresh command.
result range
Returns a range object that represents the area of the worksheet occupied by the specified
query table. Read-only.
The range doesn't include the field name row or the row number column.
row numbers
True if row numbers are added as the first column of the specified query table. Read/write.
Setting this property to true doesn't immediately cause row numbers to appear. The row
numbers appear the next time the query table is refreshed, and they're reconfigured every time
the query table is refreshed.
save data
True if data for the PivotTable report is saved with the workbook. False if only the PivotTable
definition is saved. Read/write.
Microsoft Excel Suite
135
save password
True if password information in an ODBC connection string is saved with the specified query.
False if the password is removed. Read/write.
This property affects only ODBC queries.
sql
Returns or sets the SQL query string used with the specified ODBC data source. Read/write.
This property supports the full ODBC Data Manipulation Language (DML) grammar,
including wild card characters and stored procedures that return data. This property does not
support Data Definition Language (DDL) statements.
tables only from html
True if only the HTML tables in the document are read when a query table is refreshed. False
if the entire HTML document is read when a query table is refreshed. This property has an
effect only when the query table is using a URL connection and the Web query returns an
HTML document. Read/write.
text file column data types
Returns or sets an ordered list of constants that specify the data types applied to the
corresponding columns in the text file that you're importing into a query table. The default
constant for each column is general format. Read/write.
Can be any of the following:
general format
text format
MDY format
DMY format
YMD format
MYD format
DYM format
YDM format
skip column
Use this property only when your query table is based on data from a text file (with the query
type property set to text import).
If you specify more elements in the list than there are columns, those values are ignored.
text file comma delimiter
True if the comma is the delimiter when you import a text file into a query table. False if you
want to use some other character as the delimiter. The default value is false. Read/write.
Use this property only when your query table is based on data from a text file (with the query
type property set to text import) and only if the value of the text file parse type property is
delimited.
Microsoft Excel Suite
136
text file consecutive delimiter
True if consecutive delimiters are treated as a single delimiter when you import a text file into
a query table. The default value is false. Read/write.
Use this property only when your query table is based on data from a text file (with the query
type property set to text import) and only if the value of the text file parse type property is
delimited.
text file decimal separator
Returns or sets the decimal separator character that Excel uses when you import a text file into
a query table. The default is the system decimal separator character. Read/write.
Use this property only when your query table is based on data from a text file (with the query
type property set to text import), when the file contains decimal and thousands separators that
are different from those used on the computer due to a different language setting being used.
The following table shows the results when you import text into Excel using various
separators. Numeric results are displayed in the rightmost column.
System
decimal
separator
System
thousands
separator
TextFile
DecimalSeparator
value
TextFile
ThousandsSeparator
value
Text
imported
Cell value
(data type)
Period Comma Comma Period 123.123,45 123,123.45
(numeric)
Period Comma Comma Comma 123.123,45 123.123,45
(text)
Comma Period Comma Period 123,123.45 123,123.45
(numeric)
Period Comma Period Comma 123 123.45 123 123.45
(text)
Period Comma Period Space 123 123.45 123,123.45
(numeric)
text file fixed column widths
Returns or sets a list of integers that correspond to the widths of the columns (in characters) in
the text file that you're importing into a query table. Valid widths are from 1 through 32767
characters. Read/write.
Use this property only when your query table is based on data from a text file (with the query
type property set to text import) and only if the value of the text file parse type property is fixed
width.
You must specify a valid, nonnegative column width. If you specify columns that exceed the
width of the text file, those values are ignored. If the width of the text file is greater than the
total width of columns you specify, the balance of the text file is imported into an additional
column.
Microsoft Excel Suite
137
text file other delimiter
Returns or sets the character used as the delimiter when you import a text file into a query
table. The default value is null. Read/write.
Use this property only when your query table is based on data from a text file (with the query
type property set to text import) and only if the value of the text file parse type property is
delimited.
If you specify more than one character in the string, only the first character is used.
text file parse type
Returns or sets the column format for the data in the text file that you're importing into a
query table. Read/write.
Can be one of the following:
Value Description
delimited
The file is delimited by delimiter characters.
fixed width
The data in the file is arranged in columns of fixed widths.
The default value is delimited.
Use this property only when your query table is based on data from a text file (with the query
type property set to text import).
text file platform
Returns or sets the origin of the text file you're importing into the query table. This property
determines which code page is used during the data import.
Can be any of the following:
Macintosh
MSDos
MSWindows
The default value is the current setting of the File Origin option in the Text File Import
Wizard. Read/write.
Use this property only when your query table is based on data from a text file (with the query
type property set to text import).
text file prompt on refresh
True if you want to specify the name of the imported text file each time the query table is
refreshed. The Import Text File dialog box allows you to specify the path and file name. The
default value is false. Read/write.
Use this property only when your query table is based on data from a text file (with the query
type property set to text import).
If the value of this property is true, the dialog box doesn't appear the first time a query table is
refreshed.
The default value is true in the user interface.
Microsoft Excel Suite
138
text file semicolon delimiter
True if the semicolon is the delimiter when you import a text file into a query table, and if the
value of the text file parse type property is delimited. The default value is false. Read/write.
Use this property only when your query table is based on data from a text file (with the query
type property set to text import).
text file space delimiter
True if the space character is the delimiter when you import a text file into a query table. The
default value is false. Read/write.
Use this property only when your query table is based on data from a text file (with the query
type property set to text import), and only if the value of the text file parse type property is
delimited.
text file start row
Returns or sets the row number at which text parsing will begin when you import a text file
into a query table. Valid values are integers from 1 through 32767. The default value is 1.
Read/write.
Use this property only when your query table is based on data from a text file (with the query
type property set to text import).
text file tab delimiter
True if the tab character is the delimiter when you import a text file into a query table. The
default value is false. Read/write.
Use this property only when your query table is based on data from a text file (with the query
type property set to text import), and only if the value of the text file parse type property is
delimited.
text file text qualifier
Returns or sets the text qualifier when you import a text file into a query table. The text
qualifier specifies that the enclosed data is in text format. Read/write.
Can be any of the following:
text qualifier double quote
text qualifier none
text qualifier single quote
The default is text qualifier double quote.
Use this property only when your query table is based on data from a text file (with the query
type property set to text import).
text file thousands separator
Returns or sets the thousands separator character that Excel uses when you import a text file
into a query table. The default is the system thousands separator character. Read/write.
Use this property only when your query table is based on data from a text file (with the query
type property set to text import), especially when the file contains decimal and thousands
separators that are different from those used on the computer due to a different language
setting being used.
Microsoft Excel Suite
139
The following table shows the results when you import text into Excel using various
separators. Numeric results are displayed in the rightmost column.
System
decimal
separator
System
thousands
separator
TextFile
DecimalSeparator
value
TextFile
ThousandsSeparator
value
Text
imported
Cell value
(data type)
Period Comma Comma Period 123.123,45 123,123.45
(numeric)
Period Comma Comma Comma 123.123,45 123.123,45
(text)
Comma Period Comma Period 123,123.45 123,123.45
(numeric)
Period Comma Period Comma 123 123.45 123 123.45
(text)
Period Comma Period Space 123 123.45 123,123.45
(numeric)
use list object
True if a query table uses a list object to present its data. Read/write.
The default value is True.
This property must be implemented after a refresh; otherwise, an error results.
Class: recent file
Plural
recent files
Represents a file in the list of recently used files.
Use recent file index, where index is the file number, to return a recent file object. The following
example opens file two in the list of recently used files.
if (count of recent files) >= 1 then
open workbook workbook file name (path of recent file 2)
end if
Properties
entry index
Returns the index number of the object within the elements of the parent object.
name
Returns or sets the name of the object.
path
Returns the complete path of the object, excluding the final separator and name of the object.
Read-only.
Microsoft Excel Suite
140
Class: row field
Plural
row fields
Represents a row field in a PivotTable report.
Use row field index, where index is the row field's name or index number, to return a single row
field object.
This example adds the PivotTable row field names to a list on a new worksheet.
set nwSheet to make new worksheet
activate object nwSheet
set pvtTable to pivot table of range "A1" of worksheet "Sheet2"
set rw to 0
repeat with pvtField in (get row fields of pvtTable)
set rw to rw + 1
set value of cell rw of column 1 of nwSheet to (get name of pvtField)
end repeat
Properties
<Inheritance> pivot field
Inherits the properties and elements of the pivot field class.
Class: scenario
Plural
scenarios
Represents a scenario on a worksheet. A scenario is a group of input values (called changing cells)
that is named and saved.
Use scenario index, where index is the scenario name or index number, to return a single scenario
object. The following example shows the scenario named "Typical" on the worksheet named
"Options."
show scenario "Typical" of worksheet "Options"
Properties
Excel comment
Returns or sets the comment associated with the scenario. The comment text cannot exceed 255
characters. Read/write.
changing cells
Returns a range object that represents the changing cells for a scenario. Read-only.
Microsoft Excel Suite
141
entry index
Returns the index number of the object within the elements of the parent object. Read-only.
hidden
True if the scenario is hidden. The default value is false. Read/write.
locked
True if the object is locked; false if the object can be modified when the sheet is protected.
Read/write.
name
Returns or sets the name of the object. Read/write.
Class: scrollbar
Plural
scrollbars
Represents a scrollbar control. A scroll bar is a stand-alone control you can place on a form. It is
visually like the scrollbar you see in certain objects such as a list box or the drop-down portion of a
combo box. However, unlike the scrollbars in these examples, the stand-alone scrollbar is not an
integral part of any other control.
Use scrollbar index, where index is the entry index number or name to return a single scrollbar
object. The following example creates a new scrollbar.
make new scrollbar at end of worksheet 1 of workbook 1 with properties
{top:100, left position:100, height:24, width:100}
The following example gets the properties of a scrollbar object on a worksheet.
get properties of scrollbar 1 of worksheet 1 of workbook 1
Properties
bottom right cell
Returns a range object that represents the cell that lies under the lower-right corner of the
object. Read-only.
display threeD shading
True if the object has 3-D shading turned on. Read/write.
enabled
True if the object is enabled. Read/write
entry index
Returns the index number of the object within the elements of the parent object. Read-only.
height
Returns or sets the height (in points) of an object. Read/write.
Microsoft Excel Suite
142
large change
Returns or sets the amount that the scrollbar increments or decrements for a page scroll (when
the user clicks in the scrollbar body region). Read/write.
left position
Returns or sets the position (the distance from the left edge of the object to the left edge of
column A) of the specified object, in points. Read/write.
linked cell
Returns or sets the worksheet range linked to the value of the control. If you place a value in
the cell, the control takes this value. Likewise, if you change the value of the control, that value
is also placed in the cell. Read/write.
locked
True if the object is locked; false if the object can be modified when the sheet is protected.
Read/write.
maximum value
Returns or sets the maximum value of the scrollbar range. The scrollbar or spinner will not
take on values greater than this maximum value. Read/write.
The value of the maximum value property must be greater than the value of the minimum value
property.
minimum value
Returns or sets the minimum value of the scrollbar range. The scrollbar or spinner will not
take on values less than this minimum value. Read/write.
The value of the minimum value property must be less than the value of the maximum value
property.
name
Returns or sets the name of the object. Read/write.
on action
Returns or sets the name of the script or Visual Basic macro that's run when the specified
object is clicked. Read/write.
placement
Returns or sets the way the object is attached to the cells below it. Read/write.
Can be one of the following:
placement free floating
placement move
placement move and size
print object
True if the object will be printed when the document is printed. Read/write.
Microsoft Excel Suite
143
small change
Returns or sets the amount that the scrollbar is incremented or decremented for a line scroll
(when the user clicks an arrow). Read/write
top
Returns or sets the position (in points) of the specified object. Read/write.
top left cell
Returns a range object that represents the cell that lies under the upper-left corner of the
specified object. Read-only.
value
Returns or sets the value of the control. Read/write.
visible
Specifies whether an object is visible or hidden. Use the visible property to control access to
information without displaying it. For example, you could use the value of a control on a
hidden form as the criterion for a query.
width
Returns or sets an object's width, in points. Read/write
z order position
Returns the position of the object in the z-order, which corresponds to the object's index
number. Read-only.
Whenever you make a new shape or object, it's added to the front of the z-order by default.
Class: sheet
Plural
sheets
Elements
shape
arc
button
cell
chart object
checkbox
dropdown
groupbox
label
line
listbox
named item
option button
oval
pivot table
range
cell
row
column
rectangle
scenario
scrollbar
spinner
textbox
horizontal page break
vertical page break
query table
Excel comment
hyperlink
list object
Represents a worksheet.
Use sheet index, where index is the worksheet index number or name to return a single sheet object.
The following example hides the first worksheet in the active workbook.
set visible of sheet 1 to sheet hidden
Microsoft Excel Suite
144
The worksheet index number denotes the position of the worksheet on the workbook's tab bar.
sheet 1 is the first (leftmost) worksheet in the workbook, and sheet (get count of sheets) is
the last one. All worksheets are included in the index count, even if they're hidden.
The worksheet name is shown on the tab for the worksheet. To set or return the worksheet name,
use the name property. The following example protects the scenarios on the first worksheet in the
workbook.
protect worksheet sheet 1 password "drowssap" with scenarios
Properties
autofilter mode
True if the AutoFilter drop-down arrows are currently displayed on the sheet. This property is
independent of the filter mode property. Read/write.
This property returns true if the drop-down arrows are currently displayed. You can set this
property to false to remove the arrows, but you cannot set it to true. To filter a list and display
the drop-down arrows, use the autofilter range command.
autofilter object
Returns an autofilter object if filtering is on. Returns missing value if filtering is off. Read-
only.
To create an autofilter object for a worksheet, you must turn AutoFilter on for a range on the
worksheet either manually or by using the autofilter range command.
circular reference
Returns a range object that represents the range containing the first circular reference on the
sheet, or returns missing value if there's no circular reference on the sheet. The circular
reference must be removed before calculation can proceed. Read-only.
consolidation function
Returns the function code used for the current consolidation. Read-only.
Can be any of the following:
do average
do count
do count numbers
do maximum
do minimum
do product
do standard deviation
do standard deviation p
do sum
do var
do var p
consolidation options
Returns a three-element list of consolidation options, as shown in the following table. If the
element is true, that option is set. Read-only.
Element Meaning
1 Use labels in top row.
2 Use labels in left column.
3 Create links to source data.
Microsoft Excel Suite
145
consolidation sources
Returns a list of string values that name the source sheets for the worksheet's current
consolidation. Returns an empty list if there's no consolidation on the sheet. Read-only.
display page breaks
True if page breaks (both automatic and manual) on the specified worksheet are displayed.
Read/write.
enable autofilter
True if AutoFilter arrows are enabled when user-interface-only protection is turned on.
Read/write.
This property applies to each worksheet and isn't saved with the worksheet or session.
enable calculation
True if Excel automatically recalculates the worksheet when necessary. False if the user cannot
request a recalculation (Excel never recalculates the sheet automatically). Read/write.
When you change this property from false to true, Excel recalculates the worksheet.
enable outlining
True if outlining symbols are enabled when user-interface-only protection is turned on.
Read/write.
This property applies to each worksheet and isn't saved with the worksheet or session.
enable pivot table
True if PivotTable controls and actions are enabled when user-interface-only protection is
turned on. Read/write.
This property applies to each worksheet and isn't saved with the worksheet or session.
There must be a sufficient number of unlocked cells below and to the right of the PivotTable
report for Excel to recalculate and display the PivotTable report.
entry index
Returns the index number of the object within the elements of the parent object. Read-only.
filter mode
True if the worksheet is in filter mode. Read-only.
This property is true if the worksheet contains a filtered list in which there are hidden rows.
name
Returns or sets the name of the object. Read/write.
next
Returns a sheet object that represents the next sheet. Read-only.
outline object
Returns an outline object that represents the outline for the specified worksheet. Read-only.
Microsoft Excel Suite
146
page setup object
Returns a page setup object that contains all the page setup settings for the specified object.
Read-only.
previous
Returns a sheet object that represents the previous sheet. Read-only.
protect contents
True if the contents of the sheet are protected. This protects the individual cells. Read-only.
protect drawing objects
True if shapes are protected. Read-only.
protection mode
True if user-interface-only protection is turned on. To turn on user interface protection, use the
protect worksheet command with the user interface only argument set to true. Read-only.
scroll area
Returns or sets the range where scrolling is allowed, as an A1-style range reference. Cells
outside the scroll area cannot be selected. Read/write.
Set this property to the empty string ("") to enable cell selection for the entire sheet.
standard height
Returns the standard (default) height (in points) of all the rows in the worksheet. Read-only.
standard width
Returns or sets the standard (default) width of all the columns in the worksheet. Read/write.
One unit of column width is equal to the width of one character in the Normal style. For
proportional fonts, the width of the character 0 (zero) is used.
transition expression evaluation
True if Excel uses Lotus 1-2-3 expression evaluation rules for the worksheet. Read/write.
used range
Returns a range object that represents the used range on the specified sheet. Read-only.
The used range is the smallest rectangle that contains all cells in the sheet containing data. The
used range may contain empty cells within it, including in its corners. For example, if the sheet
contains data only in cells A1 , E1 and C3, its used range would be "$A$1:$E$3."
visible
True if the worksheet is visible. Read/write.
Can be any of the following:
sheet visible
sheet hidden
sheet very hidden
The sheet very hidden constant hides the worksheet so that the only way for you to make it
visible again is by setting this property to true (the user cannot make the sheet visible).
Microsoft Excel Suite
147
worksheet type
Returns the worksheet type. Read-only.
Can be any of the following:
sheet type chart
sheet type dialog sheet
sheet type excel 4 intl macro sheet
sheet type excel 4 macro sheet
sheet type worksheet
Class: spinner
Plural
spinners
Represents a spinner control.
Use spinner index, where index is the entry index number or name to return a single spinner object.
The following example creates a new spinner.
make new spinner at end of worksheet 1 of workbook 1 with properties
{top:100, left position:100, height:20, width:16}
The following example gets the properties of a spinner object on a worksheet.
get properties of spinner 1 of worksheet 1 of workbook 1
Properties
bottom right cell
Returns a range object that represents the cell that lies under the lower-right corner of the
object. Read-only.
display threeD shading
True if the object has 3-D shading turned on. Read/write.
enabled
True if the object is enabled. Read/write.
entry index
Returns the index number of the object within the elements of the parent object. Read-only.
height
Returns or sets the height (in points) of an object. Read/write.
left position
Returns or sets the position (in points) of the specified object. Read/write.
Microsoft Excel Suite
148
linked cell
Returns or sets the worksheet range linked to the control's value. If you place a value in the
cell, the control takes this value. Likewise, if you change the value of the control, that value is
also placed in the cell. Read/write.
You cannot use this property if the multi select property is select simple or select extended.
locked
True if the object is locked; false if the object can be modified when the sheet is protected.
Read/write.
maximum value
Returns or sets the maximum value of the spinner range. The spinner will not take on values
greater than this maximum value. Read/write.
The value of the maximum value property must be greater than the value of the minimum value
property.
minimum value
Returns or sets the minimum value of the spinner range. The spinner will not take on values
less than this minimum value. Read/write.
The value of the minimum value property must be less than the value of the maximum value
property.
name
Returns or sets the name of the object. Read/write.
on action
Returns or sets the name of the script of Visual Basic macro that runs when the specified object
is clicked. Read/write.
placement
Returns or sets the way the object is attached to the cells below it. Read/write.
Can be one of the following:
placement free floating
placement move
placement move and size
print object
True if the object will be printed when the document is printed. Read/write.
small change
Returns or sets the amount that the spinner is incremented or decremented for a line scroll
(when the user clicks an arrow). Read/write.
Microsoft Excel Suite
149
top
Returns or sets the position (in points) of the specified object. Read/write.
top left cell
Returns a range object that represents the cell that lies under the upper-left corner of the
specified object. Read-only.
value
Returns or sets the value of the control. Read/write.
visible
Specifies whether an object is visible or hidden. Use the visible property to control access to
information without displaying it. For example, you could use the value of a control on a
hidden form as the criterion for a query.
width
Returns or sets an object's width, in points. Read/write
z order position
Returns the position of the object in the z-order, which corresponds to the object's index
number. Read-only.
Whenever you make a new shape or object, it's added to the front of the z-order by default.
Class: textbox
Plural
textboxes
Represents a textbox control.
Use textbox index, where index is the entry index number or name to return a single textbox object.
The following example creates a new textbox.
make new textbox at end of worksheet 1 of workbook 1 with properties
{top:100, left position:100, height:24, width:100}
The following example gets the properties of a textbox object on a worksheet.
get properties of textbox 1 of worksheet 1 of workbook 1
Properties
add indent
Returns or sets whether the text is automatically indented when the text alignment in a cell is
set to equal distribution either horizontally or vertically.
This property is not used in U.S. English versions of Excel.
Microsoft Excel Suite
150
auto scale font
True if the text in the object changes font size when the object size changes. The default value
is true. Read/write.
auto size
True if the size of the specified object is changed automatically to fit text within its boundaries.
Read/write.
border
Returns a border object that represents the border of the object. Read-only.
bottom right cell
Returns a range object that represents the cell that lies under the lower-right corner of the
object. Read-only.
caption
Returns or sets the caption for this object. Read/write.
enabled
True if the object is enabled. Read/write
entry index
Returns the index number of the object within the elements of the parent object. Read-only.
font object
Returns a font object that represents the font of the specified object. Read-only.
formula
Returns or sets the object's formula in A1-style notation. Read/write.
If the cell contains a constant, this property returns the constant. If the cell is empty, formula
returns an empty string. If the cell contains a formula, formula returns the formula as a string,
in the same format in which it would be displayed in the formula bar (including the equal
sign).
If you set the value or formula of a cell to a date, Excel checks to see whether that cell is
already formatted with one of the date or time number formats. If not, Excel changes the
number format to the default short date number format.
If the range is a one- or two-dimensional list, you can set the formula to an array formula of
the same dimensions. Similarly, you can put the formula into a list.
Setting the formula for a multiple-cell range fills all cells in the range with the formula.
height
Returns or sets the height (in points) of an object. Read/write.
Microsoft Excel Suite
151
horizontal alignment
Returns or sets the horizontal alignment for the object. Read/write.
Can be one of the following:
horizontal align center
horizontal align center across selection
horizontal align distributed
horizontal align fill
horizontal align general
horizontal align justify
horizontal align left
horizontal align right
The horizontal align distributed alignment style works only in the Japanese version of Excel
or in an English version of Excel that you have registered as Japanese by using the Microsoft
Language Register application.
interior object
Returns an interior object that represents the interior of the specified object. Read-only.
left position
Returns or sets the position (in points) of the specified object. The position is defined as the
distance from the left edge of the object to the left edge of column A. Read/write.
locked
True if the object is locked; false if the object can be modified when the sheet is protected.
Read/write.
locked text
True if the text in the specified object will be locked to prevent changes when the workbook is
protected. Read/write.
name
Returns or sets the name of the object. Read/write.
on action
Returns or sets either the name of the script or VB macro that runs when the specified object is
clicked. AppleScript scripts are not saved with the document. Read/write.
Microsoft Excel Suite
152
orientation
Returns or sets the object's orientation. Read/write.
Can be one of the following:
orientation down
orientation horizontal
orientation upward
orientation vertical
Can also be a number value between -90 and 90 degrees.
placement
Returns or sets the way the object is attached to the cells below it. Read/write.
Can be one of the following:
placement free floating
placement move
placement move and size
print object
True if the object will be printed when the document is printed. Read/write.
reading order
This property is not currently supported.
rounded corners
True if the object has rounded corners. Read/write
shadow
True if the font is a shadow font or if the object has a shadow. Read/write.
string value
Returns or sets the text of the specified object. Read/write.
top
Returns or sets the position (in points) of the specified object. Read/write.
top left cell
Returns a range object that represents the cell that lies under the upper-left corner of the
specified object. Read-only.
Microsoft Excel Suite
153
vertical alignment
Returns or sets the vertical alignment of the object. Read/write.
Can be one of the following:
vertical alignment top
vertical alignment center
vertical alignment bottom
vertical alignment justify
vertical alignment distributed
The vertical alignment distributed alignment style works only in the Japanese version of
Excel or in an English version of Excel that you have registered as Japanese by using the
Microsoft Language Register application.
visible
Specifies whether an object is visible or hidden. Use the visible property to control access to
information without displaying it. For example, you could use the value of a control on a
hidden form as the criterion for a query.
width
Returns or sets an object's width, in points. Read/write
wrap auto text
True if multiple lines of text are displayed in a text frame. The default value is true.
Read/write.
z order position
Returns the position of the object in the z-order, which corresponds to the object's index
number. Read-only.
Whenever you make a new shape or object, it's added to the front of the z-order by default.
Class: validation
Plural
validations
Represents data validation for a worksheet range.
Use the validation property to return the validation object. This example changes data validation for
cell E5.
set v1 to validation of range "E5"
modify v1 type validate list alert style valid alert stop ¬
formula1 "=$A$1:$A$10"
Microsoft Excel Suite
154
To add data validation to a range and create a new validation object, use the add data validation
command. The following example adds data validation to cell E5.
add data validation (validation of range "E5") ¬
type validate whole number ¬
alert style valid alert information ¬
formula1 "5" formula2 "10"
set input title of validation of range "E5" to "Integers"
set error title of validation of range "E5" to "Integers"
set input message of validation of range "E5" to ¬
"Enter an integer from five to ten"
set error message of validation of range "E5" to ¬
"You must enter a number from five to ten"
Properties
IME mode
Returns or sets the description of the Japanese input rules. Read/write.
Can be one of the following:
IME mode no control
IME mode on
IME mode off
IME mode disable
IME mode hiragana
IME mode katakana
IME mode katakana half
IME mode alpha full
IME mode alpha
IME mode hangul full
IME mode hangul
This property is available only in the Japanese version of Excel or in an English version of
Excel that you have registered as Japanese by using the Microsoft Language Register
application.
alert style
Returns the validation alert style. Read-only.
Can be one of the following:
valid alert none
valid alert stop
valid alert warning
valid alert information
To set the alert style for a range, use the add data validation command. If the range already
has data validation, use the modify command to change the alert style.
error message
Returns or sets the data validation error message. Read/write.
error title
Returns or sets the title of the data-validation error dialog box. Read/write.
Microsoft Excel Suite
155
formula1
Returns the value or expression associated with the conditional format or data validation. Can
be a constant value, a string value, a cell reference, or a formula. Read-only.
formula2
Returns the value or expression associated with the second part of a conditional format or data
validation. Used only when the validation operator property is operator between or operator
not between. Can be a constant value, a string value, a cell reference, or a formula. Read-only.
ignore blank
True if blank values are permitted by the range data validation. Read/write.
If true, cell data is considered valid if the cell is blank, or if a cell referenced by either the
minimum value or maximum value property is blank.
in cell dropdown
True if data validation displays a drop-down list that contains acceptable values. Read/write.
This property is ignored if the validation type isn't validate list.
input message
Returns or sets the data validation input message. Read/write.
input title
Returns or sets the title of the data-validation input dialog box. Read/write.
show error
True if the data validation error message will be displayed whenever the user enters invalid
data. Read/write.
show input
True if the data validation input message will be displayed whenever the user selects a cell in
the data validation range. Read/write.
validation operator
Returns the operator for the conditional format or data validation. Read-only.
Can be one of the following:
operator between
operator not between
operator equal
operator not equal
operator greater
operator less
operator great equal
operator less equal
Microsoft Excel Suite
156
validation type
Returns the data validation type. Read-only.
Can be one of the following:
validate input only
validate whole number
validate decimal
validate list
validated date
validate time
validate text length
validate custom
value
True if all the validation criteria are met (that is, if the range contains valid data). Read-only.
Class: vertical page break
Plural
vertical page breaks
Represents a vertical page break.
Use vertical page break index, where index is the page break index number of the page break, to
return a vertical page break object. The following example creates new vertical page breaks.
make new vertical page break at active sheet ¬
with properties {location:range ("E5")}
make new vertical page break at active sheet ¬
with properties {location:range ("C10"), ¬
extent:page break full, ¬
vertical page break type:page break manual}
Properties
extent
Returns the type of the specified page break: full-screen or only within a print area. Read-only.
Can be one of the following:
page break full
page break partial
Microsoft Excel Suite
157
location
Returns or sets the cell (a range object) that defines the page-break location. Horizontal page
breaks are aligned with the top edge of the location cell; vertical page breaks are aligned with
the left edge of the location cell. Read/write.
vertical page break type
Returns or sets the type of vertical page break. Read/write
Can be one of the following:
page break automatic
page break manual
page break none
Class: web options
Contains workbook-level attributes used by Excel when you save a document as a Web page or
open a Web page.
You can return or set attributes either at the application (global) level or at the workbook level.
(Note that attribute values can be different from one workbook to another, depending on the
attribute value at the time the workbook was saved.) Workbook-level attribute settings override
application-level attribute settings. Application-level attributes are contained in the default web
options object.
Use the web options property to return the web options object. The following example checks to see
whether PNG (Portable Network Graphics) is allowed as an image format and then sets the option
accordingly.
set objWebOptions to web options of workbook 1
if allow png of objWebOptions is true then
set strImageFileType to "PNG"
else
set strImageFileType to "JPG"
end if
Properties
allow png
True if PNG (Portable Network Graphics) is allowed as an image format when you save or
publish a complete or partial presentation as a Web page. False if PNG is not allowed as an
output format. The default value is false. Read/write.
If you save images in the PNG format as opposed to any other file format, you might improve
the image quality or reduce the size of those image files, and therefore decrease the download
time, assuming that the Web browsers you are targeting support the PNG format.
Microsoft Excel Suite
158
encoding
Returns or sets the document encoding (code page or character set) to be used by the Web
browser when you view the saved document. Read/write. The default is the encoding Mac
Roman.
Can be one of the following:
encoding Thai
encoding Japanese ShiftJIS
encoding simplified Chinese
encoding Korean
encoding traditional Chinese
encoding little endian
encoding big endian
encoding central European
encoding Cyrillic
encoding Western
encoding Greek
encoding Turkish
encoding Hebrew
encoding Arabic
encoding Baltic
encoding Vietnamese
encoding auto detect
encoding Japanese auto detect
encoding simplified Chinese auto detect
encoding Korean auto detect
encoding traditional Chinese auto detect
encoding Cyrillic auto detect
encoding Greek auto detect
encoding Arabic auto detect
encoding ISO88591 Latin1
encoding ISO88592 central Europe
encoding ISO88593 Latin3
encoding ISO88594 Baltic
encoding ISO88595 Cyrillic
encoding ISO88596 Arabic
encoding ISO88597 Greek
encoding ISO88598 Hebrew
encoding ISO88599 Turkish
encoding ISO885915 Latin9
encoding ISO2022 Japanese no half width
Katakana
encoding ISO2022 Japanese JISX02021984
encoding ISO2022 Japanese JISX02011989
encoding ISO2022KR
encoding ISO2022CN traditional Chinese
encoding ISO2022CN simplified Chinese
encoding Mac Roman
encoding Mac Japanese
encoding Mac traditional Chinese Big5
encoding Mac Korean
encoding Mac Greek1
encoding EBCDIC Greek
encoding EBCDIC Hebrew
encoding EBCDIC Korean extended
encoding EBCDIC Thai
encoding EBCDIC Icelandic
encoding EBCDIC Turkish
encoding EBCDIC Russian
encoding EBCDIC Serbian Bulgarian
encoding EBCDIC Japanese Katakana
extended and Japanese
encoding EBCDIC US Canada and Japanese
encoding EBCDIC extended and Korean
encoding EBCDIC simplified Chinese
extended and simplified Chinese
encoding EBCDIC US Canada
and traditional Chinese
encoding EBCDIC Japanese Latin extended
and Japanese
encoding OEM United States
encoding OEM Greek
encoding OEM Baltic
encoding OEM multilingual LatinI
encoding OEM multilingual LatinII
encoding OEM Cyrillic
encoding OEM Turkish
encoding OEM Portuguese
encoding OEM Icelandic
encoding OEM Hebrew
encoding OEM Canadian French
encoding OEM Arabic
encoding OEM Nordic
encoding OEM CyrillicII
encoding OEM modern Greek
encoding EUC Japanese
encoding EUC Chinese simplified Chinese
encoding EUC Korean
encoding EUC Taiwanese
traditional Chinese
encoding Devanagari
encoding Bengali
encoding Tamil
encoding Telugu
encoding Assamese
encoding Oriya
encoding Kannada
encoding Malayalam
Microsoft Excel Suite
159
encoding Mac Cyrillic
encoding Mac simplified Chinese GB2312
encoding Mac Romania
encoding Mac Ukraine
encoding Mac Latin2
encoding Mac Icelandic
encoding Mac Turkish
encoding Mac Croatia
encoding EBCDIC US Canada
encoding EBCDIC International
encoding EBCDIC multilingual
ROECE Latin2
encoding EBCDIC Greek modern
encoding EBCDIC Turkish Latin5
encoding EBCDIC Germany
encoding EBCDIC Denmark Norway
encoding EBCDIC Finland Sweden
encoding EBCDIC Italy
encoding EBCDIC Latin America Spain
encoding EBCDIC United Kingdom
encoding EBCDIC Japanese
Katakana extended
encoding EBCDIC France
encoding EBCDIC Arabic
encoding Gujarati
encoding Punjabi
encoding Arabic ASMO
encoding Arabic transparent ASMO
encoding Korean Johab
encoding Taiwan CNS
encoding Taiwan TCA
encoding Taiwan Eten
encoding Taiwan IBM5550
encoding Taiwan teletext
encoding Taiwan Wang
encoding IA5 German
encoding IA5 Swedish
encoding IA5 Norwegian
encoding US ASCII
encoding T61
encoding ISO6937 nonspacing accent
encoding Ext alpha lowercase
encoding KOI8U
encoding Europa3
encoding HZGB simplified Chinese
encoding UTF7
encoding UTF8
location of components
This property is not currently supported.
pixels per inch
Returns or sets the density (pixels per inch) of graphics images and table cells on a Web page.
The range of settings is usually from 19 to 480, and common settings for popular screen sizes
are 72, 96, and 120. The default setting is 96. Read/write.
This property determines the size of the images and cells on the specified Web page relative to
the size of text whenever you view the saved document in a Web browser. The physical
dimensions of the resulting image or cell are the result of the original dimensions (in inches)
multiplied by the number of pixels per inch.
To set the optimum screen size for the targeted Web browsers, use the screen size property.
screen size
Returns or sets the ideal minimum screen size (width by height, in pixels) that you should use
when viewing the saved document in a Web browser. Read/write.
Can be one of the following:
resolution544x376
resolution640x480
resolution720x512
resolution800x600
resolution1024x768
resolution1152x882
resolution1152x900
resolution1280x1024
resolution1600x1200
resolution1800x1440
resolution1920x1200
The default value is resolution800x600.
Microsoft Excel Suite
160
use long file names
True if long file names are used when you save the document as a Web page. False if long file
names are not used and the MS-DOS file name format (8.3) is used. The default value is true.
Read/write.
If you don't use long file names and your document has supporting files, Excel automatically
organizes those files in a separate folder.
web page keywords
Returns or sets keywords for the worksheet when it is saved as a Web page. Read/write.
Keywords are not visible in Web browsers, but are stored in meta tags to facilitate page
searches.
web page title
Returns or sets the title of a worksheet when it is saved as a Web page. Read/write.
Class: window
Plural
windows
Represents a window. Many worksheet characteristics, such as scroll bars and gridlines, are actually
properties of the window.
Use window index, where index is the window name or index number, to return a single window
object. The following example maximizes window 1.
set window state of window 1 to window state maximized
Note that the active window is always
Window 1.
The window caption is the text shown in the title bar at the top of the window when the window
isn't maximized. The caption is also shown in the list of open files on the bottom of the Windows
menu. To set or return the window caption, use the caption property . Changing the window caption
doesn't change the name of the workbook. The following example turns off cell gridlines for the
worksheet shown in the book1.xls:1 window.
set display gridlines of window "book.xls:1" to false
Properties
active cell
Returns a range object that represents the active cell in the active window (the window on top)
or in the specified window. If the window isn't displaying a worksheet, this property fails.
Read-only.
If you don't specify an object qualifier, this property returns the active cell in the active
window.
Be careful to distinguish between the active cell and the selection. The active cell is a single cell
inside the current selection. The selection may contain more than one cell, but only one is the
active cell.
The following expressions all return the active cell, and are all equivalent.
active cell
active cell of active window
Microsoft Excel Suite
161
active chart
Returns a chart object that represents the active chart (either an embedded chart or a chart
sheet). An embedded chart is considered active when it's either selected or activated. When no
chart is active, this property returns an incorrect response. Read-only.
If you don't specify an object qualifier, this property returns the active chart in the active
workbook.
active pane
Returns a pane object that represents the active pane in the window. Read-only.
This property can be used only on worksheets and macro sheets. You must use the entry index
property to obtain the index of the active pane.
active sheet
Returns an object that represents the active sheet (the sheet on top) in the active workbook or
in the specified window or workbook. Returns an incorrect response if no sheet is active. Read-
only.
If you don't specify an object qualifier, this property returns the active sheet in the active
workbook.
If a workbook appears in more than one window, the active sheet property may be different in
different windows.
caption
The name that appears in the title bar of the document window. Read/write.
display formulas
True if the window is displaying formulas; false if the window is displaying values.
Read/write.
This property applies only to worksheets and macro sheets.
display gridlines
True if gridlines are displayed. Read/write.
This property applies only to worksheets and macro sheets.
This property affects only displayed gridlines. To control the printing of gridlines, use the print
gridlines property.
display headings
True if both row and column headings are displayed; false if no headings are displayed.
Read/write.
This property applies only to worksheets and macro sheets.
This property affects only displayed headings. To control the printing of headings, use the
print gridlines property.
display horizontal scroll bar
True if the horizontal scroll bar is displayed. Read/write.
Microsoft Excel Suite
162
display outline
True if outline symbols are displayed. Read/write.
This property applies only to worksheets and macro sheets.
display vertical scroll bar
True if the vertical scroll bar is displayed. Read/write.
display workbook tabs
True if the workbook tabs are displayed. Read/write.
display zeros
True if zero values are displayed. Read/write.
This property applies only to worksheets and macro sheets.
enable resize
True if the window can be resized. Read/write.
entry index
Returns the index of this item in the element list of windows. Read-only.
freeze panes
True if split panes are frozen. Read/write.
It's possible for freeze panes to be true and split to be false, or vice versa.
This property applies only to worksheets and macro sheets.
gridline color
Returns or sets the gridline color as an RGB value. Read/write.
gridline color index
Returns or sets the gridline color as an index into the current color palette, or as one of the
following constants:
color index automatic
color index none
a color index integer
Read/write.
The following illustration shows the color-index values in the default color palette.
Microsoft Excel Suite
163
height
Returns or sets the height (in points) of the window. To determine the maximum size for the
window, use the usable height property. You cannot set this property if the window is
maximized or minimized. To determine the window state, use the window state property.
left position
Returns or sets the distance (in points) from the left edge of the client area to the left edge of
the window. Read/write.
range selection
Returns a range object that represents the selected cells on the worksheet in the specified
window even if a graphic object is active or selected on the worksheet. Read-only.
When a graphic object is selected on a worksheet, the selection property returns the graphic
object instead of a range object; the range selection property returns the range of cells that was
selected before the graphic object was selected.
This property and the selection property return identical values when a range (not a graphic
object) is selected on the worksheet.
If the active sheet in the specified window is not a worksheet, this property fails.
scroll column
Returns or sets the number of the leftmost column in the pane or window. Read/write.
If the window is split, the scroll column property of the window object refers to the upper-left
pane. If the panes are frozen, the scroll column property of the window object excludes the
frozen areas.
scroll row
Returns or sets the number of the row that appears at the top of the pane or window.
Read/write.
If the window is split, the scroll row property of the window object refers to the upper-left
pane. If the panes are frozen, the scroll row property of the window object excludes the frozen
areas.
selected sheets
Returns a list of sheet objects that represents all of the selected sheets in the specified window.
Read-only.
selection
Returns the selected object in the specified window. Read-only.
The returned object type depends on the current selection (for example, if a cell is selected, this
property returns a range object). The selection property returns missing value if there is no
selection.
split
True if the window is split. Read/write.
It's possible for freeze panes to be true and split to be false, or vice versa.
This property applies only to worksheets and macro sheets.
Microsoft Excel Suite
164
split column
Returns or sets the column number where the window is split into panes (the number of
columns to the left of the split line). Read/write.
split horizontal
Returns or sets the location (in points) of the horizontal window split. Read/write.
split row
Returns or sets the row number where the window is split into panes (the number of rows
above the split). Read/write.
split vertical
Returns or sets the location (in points) of the vertical window split. Read/write.
tab ratio
Returns or sets the ratio of the width of the workbook's tab area to the width of the window's
horizontal scroll bar (as a number between 0 (zero) and 1; the default value is 0.75.
Read/write.
This property has no effect when display workbook tabs is set to false (its value is retained, but it
has no effect on the display).
top
Returns or sets the distance (in points) from the top edge of the window to the top edge of the
usable area (below the menus, any toolbars docked at the top, and the formula bar).
Read/write
You cannot set this property for a maximized window. To return or set the state of the
window, use the window state property.
usable height
Returns the maximum height (in points) of the space that a window can occupy in the
application window area. Read-only.
usable width
Returns the maximum width (in points) of the space that a window can occupy in the
application window area. Read-only.
view
Returns or sets the view showing in the window. Read/write.
Can be one of the following:
normal view
page break preview
page layout view
visible
True if the window is visible. Read/write.
Microsoft Excel Suite
165
visible range
Returns a range object that represents the range of cells that are visible in the window or pane.
If a column or row is partially visible, it's included in the range. Read-only.
width
Returns or sets an object's width, in points. Read/write.
To determine the maximum size for the window, use the usable width property.
You cannot set this property if the window is maximized or minimized. To determine the
window state, use the window state property.
window number
Returns the window number. For example, a window named "Book1.xls:2" has 2 as its window
number. Most windows have the window number 1. Read-only.
The window number isn't the same as the window index (the return value of the entry index
property), which is the position of the window within the list of window objects.
window state
This property is not currently supported.
window type
Returns or sets the window type. Read/write.
Can be one of the following:
window type chart as window
window type chart in place
window type clipboard
window type info
window type workbook
zoom
Returns or sets the display size of the window, as a percentage (100 equals normal size, 200
equals double size, and so on). Read/write.
This function affects only the sheet that's currently active in the window. To use this property
on other sheets, you must first activate them.
Class: workbook
Plural
workbooks
Represents an Excel workbook.
Use workbook index, where index is the workbook name or index number, to return a single
workbook object. The following example activates workbook 1. The application must be active for
this command to be successful.
activate object workbook 1
Microsoft Excel Suite
166
The following example closes all open workbooks without prompting the user to save.
close every workbook saving no
The index number denotes the order in which the workbooks were opened or created.
workbook 1
is the first workbook opened or created, and
workbook (get count of workbooks) is the last one
opened or created. Activating a workbook doesn't change its index number. All workbooks are
included in the index count, even if they're hidden.
The name property returns the workbook name. You cannot set the name by using this property; to
change the name, use the save workbook as command to save the workbook under a different
name. The following example activates Sheet1 in the workbook named "cogs.xls" (the workbook
must already be open in Excel).
activate object worksheet 1 of workbook "cogs.xls"
To return the workbook that's currently active, use the active workbook command. The following
example sets the active workbook to read-only status:
set read only of active workbook to true
Properties
accept labels in formulas
True if labels can be used in worksheet formulas. The default value is true. Read/write.
active chart
Returns a chart object that represents the active chart (either an embedded chart or a chart
sheet). An embedded chart is considered active when it's either selected or activated. When no
chart is active, this property returns an incorrect result. Read-only.
If you don't specify an object qualifier, this property returns the active chart in the active
workbook.
active sheet
Returns an object that represents the active sheet (the sheet on top) in the active workbook or
in the specified window or workbook. Returns an incorrect result if no sheet is active. Read-
only.
If you don't specify an object qualifier, this property returns the active sheet in the active
workbook.
If a workbook appears in more than one window, the active sheet property may be different in
different windows.
auto update frequency
Returns or sets the number of minutes between automatic updates to the shared workbook. If
this property is set to zero (0), updates occur only when the workbook is saved. Read/write.
auto update save changes
True if current changes to the shared workbook are posted to other users whenever the
workbook is automatically updated. False if changes aren't posted (this workbook is still
synchronized with changes made by other users). The default value is true. Read/write.
The auto update frequency property must be set to a value from 5 to 1440 for this property to
take effect.
Microsoft Excel Suite
167
calculation version
Returns a number whose rightmost four digits are the minor calculation engine version
number, and whose other digits (on the left) are the major version of Excel. For a workbook
object, this property returns the information about the version of Excel that the workbook was
last fully recalculated by. Read-only.
If the workbook was saved in an earlier version of Excel and if the workbook hasn't been fully
recalculated, then this property returns 0.
change history duration
Returns or sets the number of days shown in the change history of the shared workbook.
Read/write.
Any changes in the change history older than the setting for this property are removed when
the workbook is closed.
conflict resolution
Returns or sets the way conflicts are to be resolved whenever a shared workbook is updated.
Read/write.
Can be one of the following.
Constant Description
local session changes
The local user's changes are always accepted.
other session changes
The local user's changes are always rejected.
user resolution
A dialog box asks the user to resolve the conflict.
create backup
True if a backup file is created when this file is saved. Read-only.
date 1904
True if the workbook uses the 1904 date system. Read/write.
display drawing objects
Returns or sets how shapes are displayed. Read/write.
Can be one of the following.
Constant Description
display shapes
Show all shapes.
placeholders
Show only placeholders.
hide
Hide all shapes.
Microsoft Excel Suite
168
file format
Returns the file format and/or type of the workbook. Read-only.
The following formats are available only in the Japanese version of Excel: WJ2WD1 file
format, Excel 2 east asian file format, and works 2 east asian file format.
Can be set to any of the following:
add in file format
CSV file format
CSV Mac file format
CSV MSDos file format
CSV Windows file format
DBF2 file format
DBF3 file format
DBF4 file format
DIF file format
Excel2 file format
Excel 2 east asian file format
Excel3 file format
Excel4 file format
Excel 4 workbook file format
Excel7 file format
Excel 9795 file format
international add in file format
international macro file format
workbook normal file format
SYLK file format
template file format
current platform text file format
text Mac file format
text MSDos file format
text printer file format
text windows file format
WJ2WD1 file format
Works1 file format
Works 1 all file format
Works 1 fmt file format
Works3 file format
Works 3 fm 3 file format
Works4 file format
works file format
works 2 east asian file format
WQ1 file format
WJ3 file format
WJ3FJ3 file format
HTML file format
XML spreadsheet file format
full name
Returns the name of the object, including its path on disk, as a string. Read-only.
This property is equivalent to the path property, followed by the current file system separator,
followed by the name property.
has password
True if the workbook has a protection password. Read-only.
You can assign a protection password to a workbook by using the save workbook as
command.
highlight changes on screen
True if changes to the shared workbook are highlighted on-screen. Read/write.
Microsoft Excel Suite
169
is add in
True if the workbook is running as an add-in. Read/write.
When you set this property to true, the workbook has the following characteristics:
You won't be prompted to save the workbook if changes are made while the
workbook is open.
The workbook window won't be visible.
Any Visual Basic macros in the workbook won't be visible in the Macro dialog box
(displayed by pointing to Macro on the Tools menu, and then clicking Macros).
VB macros in the workbook can still be run from the Macro dialog box even though
they're not visible. In addition, VB macro names don't need to be qualified with the
workbook name.
Holding down the SHIFT key when you open the workbook has no effect.
keep change history
True if change tracking is enabled for the shared workbook. Read/write.
list changes on new sheet
True if changes to the shared workbook are shown on a separate worksheet. Read/write.
multi user editing
True if the workbook is open as a shared list. Read-only.
To save a workbook as a shared workbook, use the save workbook as command. To switch
the workbook from shared mode to exclusive mode, use the exclusive access command.
name
Returns or sets the name of the object. The name of a range object is a name object. For every
other type of object, the name is a string.
password
Returns or sets the password that must be supplied to open the specified workbook.
Read/write.
path
Returns the complete path of the workbook's container (folder), excluding the final separator
(":"). Read-only.
personal view list settings
True if filter and sort settings for lists are included in the user's personal view of the shared
workbook. Read/write.
personal view print settings
True if print settings are included in the user's personal view of the shared workbook. Read-
write.
Microsoft Excel Suite
170
precision as displayed
True if calculations in this workbook will be done using only the precision of the numbers as
they're displayed. Read/write.
protect structure
True if the order of the sheets in the workbook is protected. Read-only.
protect windows
True if the windows of the workbook are protected. Read-only.
read only
True if the workbook has been opened as read-only. Read-only.
read only recommended
True if the workbook was saved as read-only recommended. Read-only.
When you open a workbook that was saved as read-only recommended, Excel displays a
message recommending that you open the workbook as read-only.
Use the save workbook as command to change this property.
remove personal information
True if personal information can be removed from the specified workbook. The default value
is false. Read/write.
revision number
Returns the number of times the workbook has been saved while open as a shared workbook.
If the workbook is open in exclusive mode, this property returns 0 (zero). Read-only.
The revision number property is updated only when the local copy of the workbook is saved,
not when remote copies are saved.
save link values
True if Excel saves external link values with the workbook. Read/write.
saved
True if no changes have been made to the specified workbook since it was last saved.
Read/write.
If a workbook has never been saved, its path property returns an empty string ("").
You can set this property to true if you want to close a modified workbook without either
saving it or being prompted to save it.
show conflict history
True if the Conflict History worksheet is visible in the workbook that's open as a shared
workbook. Read/write.
If the specified workbook isn't open as a shared workbook, this property fails. To determine
whether a workbook is open as a shared workbook, use the multi user editing property.
Microsoft Excel Suite
171
template remove external data
True if external data references are removed when the workbook is saved as a template.
Read/write.
update remote references
True if Excel updates remote references in the workbook. Read/write.
user status
Returns a 1-based, two-dimensional list that provides information about each user who has the
workbook open as a shared list. The first element of the second dimension is the name of the
user, the second element is the date and time when the user last opened the workbook, and the
third element is a number indicating the type of list (1 indicates exclusive; 2 indicates shared).
Read-only.
The user status property doesn't return information about users who have the specified
workbook open as read-only.
web options
Returns the web options object, which contains workbook-level attributes used by Excel when
you save a document as a Web page or open a Web page. Read-only.
workbook comments
Returns or sets the comment string for this workbook. Read/write.
write password
Returns or sets a string for the write password of the workbook. Read/write.
write reserved
True if the workbook is write-reserved. Read-only.
Use the write reservation password argument of the save workbook as command to set this
property.
write reserved by
Returns the name of the user who currently has write permission for the workbook. Read-
only.
Class: worksheet
Plural
worksheets
Represents a worksheet.
Use worksheet index, where index is the worksheet index number or name to return a single
worksheet object. The following example hides worksheet one in the active workbook.
set visible of worksheet 1 to false
The worksheet index number denotes the position of the worksheet on the tab bar of the workbook.
worksheet 1 is the first (leftmost) worksheet in the workbook, and worksheet (get count of
worksheets)
is the last one. All worksheets are included in the index count, even if they're hidden.
Microsoft Excel Suite
172
The worksheet name is shown on the tab for the worksheet. To set or return the worksheet name,
use the name property. The following example protects the scenarios on Sheet1.
protect worksheet sheet "Sheet1" password "drowssap" with scenarios
When a worksheet is the active sheet, you can use the active sheet property to refer to it. The
following example uses the activate command to activate Sheet 1, sets the page orientation to
landscape mode, and then prints the worksheet.
activate object worksheet "Sheet1"
set page orientation of page setup object of active sheet to landscape
print out active sheet
Properties
<Inheritance> sheet
Inherits the properties and elements of the sheet class.
enable selection
Returns or sets what can be selected on the sheet. This property takes effect only when the
worksheet is protected. Read/write.
Can be one of the following.
Constant Description
no selection
Prevents any selection on the sheet.
unlocked cells
Allows only those cells whose locked property is false to be selected.
no restrictions
Allows any cell to be selected.
protect scenarios
True if the worksheet scenarios are protected. Read-only.
Microsoft Excel Suite
173
Microsoft Excel Suite Commands
accept all changes.......................................................................................................................................................175
activate next ................................................................................................................................................................175
activate object.............................................................................................................................................................. 176
activate previous ........................................................................................................................................................176
add chart autoformat ................................................................................................................................................. 176
add custom list............................................................................................................................................................177
add data validation ....................................................................................................................................................177
add fields to pivot table............................................................................................................................................. 178
add item to list............................................................................................................................................................ 179
add to favorites...........................................................................................................................................................179
auto show ....................................................................................................................................................................180
auto sort.......................................................................................................................................................................180
break link.....................................................................................................................................................................181
bring to front...............................................................................................................................................................181
calculate ....................................................................................................................................................................... 181
calculate full ................................................................................................................................................................ 182
cancel refresh .............................................................................................................................................................. 182
centimeters to points..................................................................................................................................................182
change data type of list column................................................................................................................................ 183
change file access........................................................................................................................................................ 184
change link ..................................................................................................................................................................184
change scenario...........................................................................................................................................................185
check spelling.............................................................................................................................................................. 185
check spelling for........................................................................................................................................................186
circle invalid................................................................................................................................................................186
clear arrows.................................................................................................................................................................187
clear circles ..................................................................................................................................................................187
clear contents ..............................................................................................................................................................187
convert formula .......................................................................................................................................................... 188
convert to range..........................................................................................................................................................188
copy object................................................................................................................................................................... 189
copy picture.................................................................................................................................................................189
copy worksheet...........................................................................................................................................................189
create new document.................................................................................................................................................189
create summary for scenarios ...................................................................................................................................190
cut.................................................................................................................................................................................190
delete chart autoformat .............................................................................................................................................191
delete custom list........................................................................................................................................................191
delete number format ................................................................................................................................................191
double click .................................................................................................................................................................192
edit................................................................................................................................................................................192
Excel comment text ....................................................................................................................................................193
Excel repeat ................................................................................................................................................................. 193
exclusive access...........................................................................................................................................................194
execute excel 4 macro................................................................................................................................................. 194
follow ........................................................................................................................................................................... 195
follow hyperlink .........................................................................................................................................................195
get border ....................................................................................................................................................................196
get clipboard formats.................................................................................................................................................197
get custom list contents .............................................................................................................................................197
get custom list num ....................................................................................................................................................197
get dialog .....................................................................................................................................................................198
get file converters .......................................................................................................................................................200
get FileMaker criteria................................................................................................................................................. 200
get international..........................................................................................................................................................200
Microsoft Excel Suite
174
get list item..................................................................................................................................................................201
get open filename .......................................................................................................................................................201
get pivot table data..................................................................................................................................................... 201
get previous selections...............................................................................................................................................201
get registered functions .............................................................................................................................................201
get save as filename ................................................................................................................................................... 202
get subtotals ................................................................................................................................................................203
get values.....................................................................................................................................................................204
get visible fields ..........................................................................................................................................................204
get webpage font ........................................................................................................................................................ 204
goto............................................................................................................................................................................... 205
help...............................................................................................................................................................................205
highlight changes options .........................................................................................................................................206
inches to points........................................................................................................................................................... 206
input box......................................................................................................................................................................207
intersect........................................................................................................................................................................208
item selected................................................................................................................................................................208
large scroll ...................................................................................................................................................................209
link info........................................................................................................................................................................209
link sources..................................................................................................................................................................210
list formulas ................................................................................................................................................................ 210
merge scenarios .......................................................................................................................................................... 210
merge workbook......................................................................................................................................................... 211
modify..........................................................................................................................................................................211
modify condition ........................................................................................................................................................213
new window on workbook.......................................................................................................................................213
next Excel comment ................................................................................................................................................... 214
on key........................................................................................................................................................................... 214
on repeat......................................................................................................................................................................216
open FileMaker file ....................................................................................................................................................217
open links .................................................................................................................................................................... 217
open text file................................................................................................................................................................ 218
open workbook........................................................................................................................................................... 220
paste special on worksheet........................................................................................................................................221
paste worksheet..........................................................................................................................................................222
pivot select...................................................................................................................................................................223
previous Excel comment ........................................................................................................................................... 224
print out.......................................................................................................................................................................224
print preview ..............................................................................................................................................................225
protect sharing............................................................................................................................................................225
protect workbook .......................................................................................................................................................226
protect worksheet....................................................................................................................................................... 226
purge change history now......................................................................................................................................... 227
refresh .......................................................................................................................................................................... 227
refresh all.....................................................................................................................................................................228
refresh query table...................................................................................................................................................... 228
refresh table................................................................................................................................................................. 229
register xll....................................................................................................................................................................229
reject all changes......................................................................................................................................................... 230
remove all items .........................................................................................................................................................230
remove item ................................................................................................................................................................230
remove user................................................................................................................................................................. 231
reset all page breaks ...................................................................................................................................................231
reset colors...................................................................................................................................................................231
run auto macros..........................................................................................................................................................232
run VB Macro.............................................................................................................................................................. 232
save as..........................................................................................................................................................................233
Microsoft Excel Suite
175
save workbook as .......................................................................................................................................................234
save workspace........................................................................................................................................................... 236
scroll workbook tabs ..................................................................................................................................................236
send to back.................................................................................................................................................................237
set background picture .............................................................................................................................................. 237
set default chart .......................................................................................................................................................... 237
set FileMaker criteria..................................................................................................................................................238
set list item...................................................................................................................................................................239
set subtotals................................................................................................................................................................. 239
show.............................................................................................................................................................................240
show all data ...............................................................................................................................................................242
show custom view...................................................................................................................................................... 242
show data form........................................................................................................................................................... 242
show levels..................................................................................................................................................................243
show pages.................................................................................................................................................................. 243
small scroll...................................................................................................................................................................244
undo .............................................................................................................................................................................244
union ............................................................................................................................................................................ 245
unprotect ..................................................................................................................................................................... 245
unprotect sharing .......................................................................................................................................................246
update .......................................................................................................................................................................... 246
update from file .......................................................................................................................................................... 246
update link ..................................................................................................................................................................247
use default folder suffix.............................................................................................................................................247
wait............................................................................................................................................................................... 247
web page preview ...................................................................................................................................................... 247
Command: accept all changes
Accepts all changes in the specified shared workbook.
Syntax
accept all changes workbook Required. An expression that returns a workbook object.
Example
This example accepts all changes in the active workbook.
accept all changes active workbook
Command: activate next
Activates the current window, sends it to the back of the window z-order, then activates the next
window according to the z-order.
Syntax
activate next window Required. An expression that returns a window object.
Example
This example sends the active window to the back of the z-order. The application must be activated
for this example to run successfully.
activate next active window
Microsoft Excel Suite
176
Command: activate object
Activates the object.
Syntax
activate window/sheet/workbook/pane Required. An expression that returns a window, sheet,
workbook, or pane object.
Example
This example activates Sheet1.
activate object worksheet "Sheet1"
This example selects cells A1:C3 on Sheet1 and then makes cell B2 the active cell.
activate object worksheet "Sheet1"
select range "A1:C3" of active sheet
activate object range "B2"
This example activates Book4.xls. If Book4.xls has multiple windows, the example activates the first
window, Book4.xls:1. The application must be activated for this example to run successfully.
activate object workbook "Book4.xls"
Command: activate previous
Activates the specified window and then activates the window at the back of the window z-order.
Syntax
activate previous window Required. An expression that returns a window object.
Example
This example activates the window at the back of the z-order. The application must be activated for
this example to run successfully.
activate previous active window
Command: add chart autoformat
Adds a custom chart AutoFormat to the list of available chart AutoFormats.
Syntax
add chart autoformat
chart chart Required. A chart that contains the format that will be applied when the new chart
AutoFormat is applied.
name Unicode text Required. The name of the AutoFormat.
[description Unicode text] Optional. A description of the custom AutoFormat.
Microsoft Excel Suite
177
Example
This example adds a new AutoFormat based on Chart1.
add chart autoformat chart active chart name "Presentation Chart"
Command: add custom list
Adds a custom list for custom autofill and/or custom sort.
Syntax
add custom list
list array range object/A1-style range reference/named range/list of strings Required. Specifies
the source data, as either a list of strings or a range object.
[by row Boolean] Optional. Used only if list array is a range object. True to create a custom list from each
row in the range. False to create a custom list from each column in the range. If this argument is omitted
and there are more rows than columns (or an equal number of rows and columns) in the range, Excel
creates a custom list from each column in the range. If this argument is omitted and there are more
columns than rows in the range, Excel creates a custom list from each row in the range.
If the list you're trying to add already exists, this command does nothing.
Example
This example adds a list of strings as a custom list.
add custom list list array {"cogs","sprockets","widgets","gizmos"}
Command: add data validation
Adds data validation to the specified range.
Syntax
add data validation validation Required. An expression that returns a validation object.
type enumeration Required. The validation type. Can be one of the following:
validate input only
validate whole number
validate decimal
validate list
validate date
validate time
validate text length
validate custom
Microsoft Excel Suite
178
[alert style enumeration] Optional. The validation alert style. Can be one of the following: valid
alert none, valid alert stop, valid alert warning, valid alert information
[operator enumeration] Optional. The data validation operator. Can be one of the following:
operator between
operator no between
operator equal
operator not equal
operator greater
operator less
operator greater equal
operator less equal
[formula1 Unicode text] Optional. The first part of the data validation equation.
[formula2 Unicode text] Optional. The second part of the data validation when operator is operator
between or operator not between (otherwise, this argument is ignored).
Example
This example adds data validation to cell A1.
add data validation (validation of range "E5") ¬
type validate whole number alert style valid alert information ¬
formula1 "5" formula2 "10"
set input title of validation of range "E5" to "Integers"
set error title of validation of range "E5" to "Integers"
set input message of validation of range "E5" to ¬
"Enter an integer from five to ten"
set error message of validation of range "E5" to ¬
"You must enter a number from five to ten"
Command: add fields to pivot table
Adds row, column, and page fields to a PivotTable.
Syntax
add fields to pivot table pivot table Required. An expression that returns a pivot table object.
[row fields list] Optional. Specifies a pivot field name (or a list of pivot field names) to be added
as rows.
[column fields list] Optional. Specifies a pivot field name (or a list of pivot field names) to be added as
columns.
Microsoft Excel Suite
179
[page fields list] Optional. Specifies a pivot field name (or a list of pivot field names) to be added as pages.
[add to table Boolean] Optional. True to add the fields to the PivotTable (none of the existing fields are
replaced). False to replace existing fields with the new fields. The default value is false.
You must specify one of the field arguments.
Example
This example replaces the existing column fields in PivotTable one on Sheet1 with the Status and
Closed_By fields.
add fields to pivot table pivot table 1 of worksheet "Sheet1" ¬
column fields {"Status","Closed By"}
Command: add item to list
Adds an item to a list box or a dropdown list.
Syntax
add item to list listbox/dropdown Required. An expression that returns a listbox or dropdown
object.
item text Unicode text Required. The text to be added.
[entry index integer] Optional. The position of the new entry. If the list has fewer entries than the specified
index, blank items from the end of the list are added to the specified position. If this argument is omitted,
the item is appended to the existing list.
Using this command clears any range specified by the list fill range property.
Example
This example creates a list box and fills it with integers from 1 to 10.
set lb to make new listbox at worksheet 1 with properties ¬
{top:100,left position:10, width:100, height:100}
repeat with x from 1 to 10
add item to list lb item text (x as string)
end repeat
Command: add to favorites
Adds a shortcut to the workbook or hyperlink to the Favorites folder.
Syntax
add to favorites workbook/hyperlink Required. An expression that returns a workbook or
hyperlink object.
Example
This example adds a shortcut to the active workbook to the Favorites folder.
add to favorites active workbook
Microsoft Excel Suite
180
Command: auto show
Displays the number of top or bottom items for a PivotTable row, page, or column field.
Syntax
auto show pivot field Required. An expression that returns a pivot field object.
type enumeration Required. To cause the PivotTable to show the items that match the specified
criteria, use type_automatic. To disable this feature, use type_manual.
range enumeration Required. The location at which to start showing items. Can be position top or position
bottom.
count integer Required. The number of items to be shown.
field Unicode text Required. The name of the base data field.
Example
This example shows only the top two companies, based on the sum of sales:
auto show pivot field "Company" of pivot table "Pivot1" ¬
of active sheet type type_automatic range position top ¬
count 2 field "Sum of Sales"
Command: auto sort
Establishes automatic PivotTable field-sorting rules.
Syntax
auto sort pivot field Required. An expression that returns a pivot field object.
sort order enumeration Required. The sort order. Can be sort ascending, sort descending, or
sort manual. Use sort manual to disable automatic sorting.
sort field Unicode text Required. The name of the sort key field.
Example
This example sorts the Company field in descending order, based on the sum of sales.
auto sort pivot field "Company" of pivot table 1 ¬
of active sheet sort order sort descending ¬
sort field "Sum of Sales"
Microsoft Excel Suite
181
Command: break link
Converts formulas linked to other Excel sources or OLE sources to values.
Syntax
break link workbook Required. An expression that returns a workbook object.
name Unicode text Required. Specifies the name of the link.
type enumeration Required. Specifies the type of link. Can be link type Excel links or link type OLE links.
Example
In this example, Excel converts all of the links (Excel link type) to a workbook named "Source.xls"
from the active workbook. This example assumes at least one formula exists in the active workbook
that links to the workbook "Source.xls."
break link active workbook name "Source.xls" ¬
type link type Excel links
Command: bring to front
Brings the object to the front of the z-order.
Syntax
bring to front button/checkbox/option
button/scrollbar/listbox/groupbox/dropdown/spinner/label/textbox Required. An expression
that returns one of the listed objects.
Example
This example brings button 1 on Sheet1 to the front of the z-order.
bring to front button 1 of sheet "Sheet1"
Command: calculate
Calculates all open workbooks or a specific worksheet in a workbook.
Syntax
calculate worksheet Required. An expression that returns a worksheet object.
Example
This example calculates all the formulas in all open workbooks
calculate
This example calculates all the formulas in Sheet1.
calculate sheet "Sheet1"
Microsoft Excel Suite
182
Command: calculate full
Forces a full calculation of the data in all open workbooks.
Syntax
calculate full
Example
This example compares the version of Excel with the version of Excel that the workbook was last
calculated in. If the two version numbers are different, a full calculation of the data in all open
workbooks is performed.
if calculation version of application "Microsoft Excel" is not equal to ¬
calculation version of workbook 1 then
calculate full
end if
Command: cancel refresh
Cancels all background queries for the specified query table. To determine whether a background
query is currently in progress, use the refreshing property of the query table object.
Syntax
cancel refresh query table Required. An expression that returns a query table object.
Example
This example cancels a query table refresh operation.
if refreshing of query table 1 of sheet 1 then
cancel refresh query table 1 of sheet 1
end if
Command: centimeters to points
Converts a measurement from centimeters to points (one point equals 0.035 centimeters).
Syntax
centimeters to points
centimeters real Required. Specifies the centimeter value to be converted to points.
Example
This example sets the left margin of Sheet1 to 5 centimeters.
set left margin of page setup object of worksheet "Sheet1" to ¬
(centimeters to points centimeters 5)
Microsoft Excel Suite
183
Command: change data type of list column
Sets the data type formatting for a list column.
Syntax
change data type of list column list column Required. An expression that returns a list column
object.
[data type enumeration] Optional. Specifies the data type to be used in the column. Can be one
of the following: no data type, whole number data, decimal data, list data, date data, time
data, text data, currency data, calculated data, or counter data.
[decimal places integer] Optional. Used for data types that can have fixed decimal places (currency data,
decimal data, or whole number data), an integer specifying the number of decimal places to use.
[currency symbol Unicode text] Optional. Used for data types that can represent currency (currency data,
decimal data, or whole number data), a string specifying the monetary symbol to use.
[date or time format Unicode text] Optional. A string containing the kind of date or time format to be used.
If known, the index of the format can also be used.
[formula Unicode text] Optional. Used when calculated data or list data is specified as the data type, a
string containing a formula or a list of items to be used in the column.
Example
This example labels the sixth column of a list object "Date Ordered", sets a date format for its data
type, and does not require that unique values be entered in the column.
set name of list column 6 of list object "RecentOrders" ¬
of active sheet to "Date Ordered"
change data type of list column list column 6 ¬
of list object "RecentOrders" of active sheet ¬
data type date data
change data type of list column list column 6 ¬
of list object "RecentOrders" of active sheet ¬
date or time format "m/d/yy"
set unique of list column 6 of list object "RecentOrders" ¬
of active sheet to false
Microsoft Excel Suite
184
Command: change file access
Changes the access permissions for the workbook. This may require an updated version to be
loaded from the disk.
Syntax
change file access workbook Required. An expression that returns a workbook object.
[mode enumeration] Optional. Specifies the new access mode. Can be read write or read only.
[write password Unicode text] Optional. Specifies the write-reserved password if the file is write reserved
and mode is read write. Ignored if there's no password for the file or if mode is read only.
[notify Boolean] Optional. True (or omitted) to notify the user if the file cannot be immediately accessed.
Remarks
If you have a file open in read-only mode, you don't have exclusive access to the file. If you change a
file from read-only to read/write, Excel must load a new copy of the file to ensure that no changes
were made while you had the file open as read-only.
Example
This example sets the active workbook to read-only.
change file access active workbook mode read only
Command: change link
Changes a link from one document to another.
Syntax
change link workbook Required. An expression that returns a workbook object.
name Unicode text Required. The name of the Excel or OLE link to be changed, as it was
returned from the link sources command.
new name Unicode text Required. The new name of the link.
[type enumeration] Optional. The link type. Can be link type Excel links or link type OLE links. The
default value is link type Excel links.
Example
This example changes an Excel link.
change link active workbook name "Source_Old.xls" ¬
new name "Source_New.xls"
Microsoft Excel Suite
185
Command: change scenario
Changes the scenario to have a new set of changing cells and (optionally) scenario values.
Syntax
change scenario scenario Required. An expression that returns a scenario object.
changing cells range Required. A range object that specifies the new set of changing cells for the
scenario. Can be a range, an A1-style range reference, a named range, or a list of category
names. The changing cells must be on the same sheet as the scenario.
[values list] Optional. A list that contains the new scenario values for the changing cells. If this argument is
omitted, the scenario values are assumed to be the current values in the changing cells.
Remarks
If you specify values, the list must contain an element for each cell in the changing cells range;
otherwise, Excel generates an error.
Example
This example sets the changing cells for scenario one to the range A1:A10 on Sheet1.
change scenario scenario 1 of worksheet "Sheet1" changing cells ¬
range "A1:A10" of worksheet "Sheet1"
Command: check spelling
Checks the spelling of an object. This form has no return value; Excel displays the Spelling dialog
box.
Syntax
check spelling sheet/button/checkbox/option button/groupbox/label/textbox Required. An
expression that returns one of the listed objects.
[custom dictionary Unicode text] Optional. A string that indicates the file name of the custom
dictionary to examine if the word isn't found in the main dictionary. If this argument is
omitted, the currently specified dictionary is used.
[ignore uppercase Boolean] Optional. True to have Excel ignore words that are all uppercase. False to have
Excel check words that are all uppercase. If this argument is omitted, the current setting will be used.
[always suggest Boolean] Optional. True to have Excel display a list of suggested alternate spellings when
an incorrect spelling is found. False to have Excel wait for you to input the correct spelling. If this
argument is omitted, the current setting will be used.
Microsoft Excel Suite
186
Remarks
To check headers, footers, and objects on a worksheet, use this command on a worksheet object.
To check only cells and notes, use this command with the cell object.
Example
This example checks the spelling on Sheet1.
check spelling sheet "Sheet1"
Command: check spelling for
Checks the spelling of a single word. Returns true if the word is found in one of the dictionaries,
false if it isn't.
Syntax
check spelling for
text to check Unicode text Required. The word you want to check.
[custom dictionary Unicode text] Optional. A string that indicates the file name of the custom
dictionary to examine if the word isn't found in the main dictionary. If this argument is
omitted, the currently specified dictionary is used.
[ignore uppercase Boolean] Optional. True to have Excel ignore words that are all uppercase. False to have
Excel check words that are all uppercase. If this argument is omitted, the current setting will be used.
Example
This example checks the spelling of a single word.
set formula of cell "A1" to check spelling for ¬
text to check "exampel" as string
Command: circle invalid
Circles invalid entries on the worksheet.
Syntax
circle invalid sheet Required. An expression that returns a sheet object.
Example
This example circles invalid entries on worksheet one.
circle invalid sheet 1
Microsoft Excel Suite
187
Command: clear arrows
Clears the tracer arrows from the worksheet. Tracer arrows are added by using the auditing feature.
Syntax
clear arrows sheet Required. An expression that returns a sheet object.
Example
This example clears tracer arrows from Sheet1.
clear arrows sheet "Sheet1"
Command: clear circles
Clears circles from invalid entries on the worksheet.
Syntax
clear circles sheet Required. An expression that returns a sheet object.
Remarks
To circle cells that contain invalid data, use the circle invalid command.
Example
This example clears circles from invalid entries on worksheet one.
clear circles sheet 1
Command: clear contents
Clears all the data, formatting, and formulas from a list object.
Syntax
clear contents list object Required. An expression that returns a list object object.
Example
This example clears the data, formatting, and formulas from list object 1 in worksheet 1.
clear contents list object 1 of worksheet 1
Microsoft Excel Suite
188
Command: convert formula
Converts cell references in a formula between the A1 and R1C1 reference styles between relative
and absolute references, or both.
Syntax
convert formula
formula to convert Unicode text Required. A string that contains the formula you want to
convert. This must be a valid formula, and it must begin with an equal sign.
from reference style enumeration Required. The reference style of the formula. Can be A1 or R1C1.
[to reference style enumeration] Optional. The reference style you want returned. Can be A1 or R1C1. If
this argument is omitted, the reference style isn't changed; the formula stays in the style specified by
from reference style.
[to absolute enumeration] Optional. Specifies the converted reference type. Can be A1 or R1C1. If this
argument is omitted, the reference type isn't changed.
[relative to range] Optional. A range object that contains one cell. Relative references relate to this cell. Can
be a range, an A1-style range reference, a named range, or a list of category names.
Example
This example converts a SUM formula that contains R1C1-style references to an equivalent formula
that contains A1-style references, and then it displays the result.
set inputFormula to "=SUM(R10C2:R15C2)"
display dialog (convert formula formula to convert inputFormula ¬
from reference style R1C1 to reference style A1)
Command: convert to range
Converts a list object to a normal Excel range.
Syntax
convert to range list object Required. An expression that returns a list object object.
Example
This example converts the second list object on worksheet 1 to a normal Excel range.
convert to range list object 2 of sheet 1
Microsoft Excel Suite
189
Command: copy object
This command is not currently supported.
Command: copy picture
This command is not currently supported.
Command: copy worksheet
Copies the sheet to another location in the workbook.
Syntax
copy worksheet sheet Required. An expression that returns a sheet object.
[before sheet] Optional. The sheet before which the copied sheet will be placed. You cannot
specify before if you specify after.
[after sheet] Optional. The sheet after which the copied sheet will be placed. You cannot specify after if you
specify before.
Remarks
If you don't specify either before or after, Excel creates a new workbook that contains the copied
sheet.
Example
This example copies Sheet1, placing the copy after Sheet3.
copy worksheet sheet "Sheet1" after sheet "Sheet3"
Command: create new document
Creates a new document linked to the specified hyperlink.
Syntax
create new document hyperlink An expression that returns a hyperlink object.
file name Unicode text. Required. The file name of the specified document.
edit now Boolean Required. True to have the specified document open immediately in its associated
editing environment.. The default value is true.
overwrite Boolean Required. True to overwrite any existing file of the same name in the same folder. False
if any existing file of the same name is preserved and the file name argument specifies a new file name.
The default value is false.
Microsoft Excel Suite
190
Example
This example creates a new document based on the new hyperlink in the first worksheet and then
loads the document into Excel for editing. The document is named "Report.xls," and it overwrites
any file of the same name in the Server:Annual folder.
Set h2 to make new hyperlink of range "A10" at active sheet ¬
with properties {address: "Server:Annual:Report.xls"}
create new document h2 file name "Server:Annual:Report.xls" ¬
with edit now with overwrite
Command: create summary for scenarios
Creates a new worksheet that contains a summary report for the scenarios on the specified
worksheet.
Syntax
create summary for scenarios worksheet Required. An expression that returns a worksheet
object.
[report type enumeration] Optional. The report type. Can be standard summary or summary
pivot table. The default value is standard summary.
[result cells range] Optional. A range object that represents the result cells on the specified worksheet. Can
be a range, an A1-style range reference, a named range, or a list of category names. Normally, this range
refers to one or more cells containing the formulas that depend on the changing cell values for your
model; that is, the cells that show the results of a particular scenario. If this argument is omitted, there are
no result cells included in the report.
Example
This example creates a summary of the scenarios on Sheet1, with result cells in the range C4:C9 on
Sheet1.
create summary for scenarios worksheet "Sheet1" ¬
result cells range "C4:C9" of worksheet "Sheet1"
Command: cut
Cuts the object to the Clipboard.
Syntax
cut button/checkbox/option
button/scrollbar/listbox/groupbox/dropdown/spinner/label/textbox Required. An expression
that returns one of the listed objects.
Example
This example cuts button 1 on Sheet1 and places it on the Clipboard.
cut button 1 of sheet "Sheet1"
Microsoft Excel Suite
191
Command: delete chart autoformat
Removes a custom chart autoformat from the list of available chart autoformats.
Syntax
delete chart autoformat
name Unicode text Required. The name of the custom autoformat to be removed.
Example
This example deletes the custom autoformat named "Presentation Chart."
delete chart autoformat name "Presentation Chart"
Command: delete custom list
Deletes a custom list.
Syntax
delete custom list
list num integer Required. The custom list number. This number must be greater than or equal
to 5 (Excel has four built-in custom lists that cannot be deleted).
Remarks
This command generates an error if the list number is less than 5 or if there's no matching custom
list.
Example
This example deletes a custom list.
set n to (get custom list num list array {"cogs", "sprockets", "widgets", ¬
"gizmos"})
delete custom list list num n
Command: delete number format
Deletes a custom number format from the workbook.
Syntax
delete number format workbook Required. An expression that returns a workbook object.
number format Unicode text Required. Names the number format to be deleted.
Example
This example deletes the number format "000-00-0000" from the active workbook.
delete number format active workbook number format "000-00-0000"
Microsoft Excel Suite
192
Command: double click
Equivalent to double-clicking the active cell.
Syntax
double click
Example
This example causes a double-click in the active cell on Sheet1.
activate object worksheet "Sheet1"
double click
Command: edit
Reruns the list wizard code with the existing list object, allowing multiple properties to be set at the
same time.
Syntax
edit list object Required. An expression that returns a list object object.
[destination type enumeration] Optional. Determines whether a range on a worksheet or an
entire worksheet serves as the destination for a list object. Can be dst range or dst sheet.
[destination Unicode text] Optional. A string specifying a single-cell reference as the destination
for the top-left corner of the list object.
[name Unicode text] Optional. A string specifying a name for the list object or sheet.
[autoformat enumeration] Optional. Specifies the kind of automatic formatting to apply to the list object.
Can be one of the following:
range autoformat threeD effects 1
range autoformat threeD effects 2
range autoformat accounting 1
range autoformat accounting 2
range autoformat accounting 3
range autoformat accounting 4
range autoformat classic 1
range autoformat classic 2
range autoformat classic 3
range autoformat color 1
range autoformat color 2
range autoformat color 3
range autoformat list 1
range autoformat list 2
range autoformat list 3
range autoformat local format 1
range autoformat local format 2
range autoformat local format 3
range autoformat local format 4
range autoformat none
range autoformat simple
[repeat headers Boolean] Optional. Used in conjunction with dst sheet. When the list sheet is
printed, determines whether column labels are reprinted on each successive page. The default
value is false.
[total row Boolean] Optional. Determines whether the list object displays a totals row. The default value is
false.
Microsoft Excel Suite
193
[visuals enumeration] Optional. Specifies how, or whether, visuals are used in the list object. Can be one of
the following: list object visual automatic (default), list object visual off, or list object visual on.
Example
This example moves the list object to the top left of worksheet 1, sets the AutoFormat to range
autoformat accounting 1, and turns the visuals off in the list object object.
edit list object 1 of sheet 1 destination type dst range ¬
destination "$A$1" autoformat range autoformat accounting 1 ¬
visuals list object visual off
Command: Excel comment text
Returns or sets the text of a comment.
Syntax
Excel comment text Excel comment Required. An expression that returns an Excel comment
object.
[text Unicode text] Optional. The text to be added.
[start integer] Optional. The character number where the added text will be placed. If this argument is
omitted, any existing text in the comment is deleted.
[over write Boolean] Optional. True to overwrite the existing text. The default value is false (text is
inserted).
Example
This example adds a comment to cell E5 on sheet one.
Excel comment text (Excel comment of range "E5") ¬
text "reviewed by Jessica"
Command: Excel repeat
Repeats the last user-interface action.
Syntax
Excel repeat
Remarks
This command repeats only the last action taken by the user before running the script or Visual
Basic macro, and it must be the first line in the script or VB macro. It cannot be used to repeat
commands.
Example
This example repeats the last user-interface action. The example must be the first line in a script or
macro.
Excel repeat
Microsoft Excel Suite
194
Command: exclusive access
Assigns the current user exclusive access to the workbook that's open as a shared list.
Syntax
exclusive access workbook Required. An expression that returns a workbook object.
Remarks
The exclusive access command saves any changes you've made to the workbook and requires other
users who have the workbook open to save their changes to a different file.
If the specified workbook isn't open as a shared list, this command fails. To determine whether a
workbook is open as a shared list, use the multi user editing property of the workbook object.
Example
This example determines whether the active workbook is open as a shared list. If it is, the example
gives the current user exclusive access.
if multi user editing of active workbook then
exclusive access active workbook
end if
Command: execute excel 4 macro
Runs an Excel 4.0 macro function and then returns the result of the function. The return type
depends on the function.
Syntax
execute excel 4 macro
VB macro name Unicode text Required. An Excel 4.0 macro language function without the
equal sign. All references must be given as R1C1 strings. If this argument contains embedded
double quotation marks, you must double them. For example, to run the macro function
=MID("sometext",1,4), this argument would have to be "MID(""sometext"",1,4)".
Remarks
The Excel 4.0 macro isn't evaluated in the context of the current workbook or sheet. This means that
any references should be external and should specify an explicit workbook name. For example, to
run the Excel 4.0 macro "My_Macro" in Book1 you must use "Book1!My_Macro()". If you don't
specify the workbook name, this command fails.
Example
This example runs the GET.CELL(42) macro function on cell C3 on Sheet1 and then displays the
result in a message box. The GET.CELL(42) macro function returns the horizontal distance from the
left edge of the active window to the left edge of the active cell.
activate object worksheet "Sheet1"
select range "C3"
display dialog (execute excel 4 macro VB macro name "GET.CELL(42)")
Microsoft Excel Suite
195
Command: follow
Displays a cached document, if it's already been downloaded. Otherwise, this command resolves
the hyperlink and opens the URL in the default web browser.
Syntax
follow hyperlink Required. An expression that returns a hyperlink object.
[new window Boolean] Optional. True to display the target application in a new window. The
default value is false.
[extra info Unicode text] Optional. A string or list that specifies additional information for HTTP to use to
resolve the hyperlink. For example, you can use extra info to specify the coordinates of an image map,
the contents of a form, or a FAT file name.
[method enumeration] Optional. Specifies the way extra info is attached. Can be one of the following:
Value Description
append string
extra info is a string that's appended to the address.
post string
extra info is posted as a string or list.
[header info Unicode text] Optional. A string that specifies header information for the HTTP
request. The default value is an empty string.
Example
This example follows the hyperlink assigned to shape 1 on the active sheet.
set var to hyperlink of shape 1 of active sheet
follow var
Command: follow hyperlink
Displays a cached document, if it's already been downloaded. Otherwise, this command resolves
the hyperlink and opens the URL in the default web browser.
Syntax
follow hyperlink workbook Required. An expression that returns a workbook object.
address Unicode text Required. The address of the target document.
[sub address Unicode text] Optional. The location within the target document. The default value is the
empty string.
[new window Boolean] Optional. True to display the target application in a new window. The default
value is false.
Microsoft Excel Suite
196
[extra info Unicode text] Optional. A string or list that specifies additional information for HTTP to use to
resolve the hyperlink. For example, you can use extra info to specify the coordinates of an image map,
the contents of a form, or a FAT file name.
[method enumeration] Optional. Specifies the way extra info is attached. Can be one of the following:
Value Description
append string
extra info is a string that's appended to the address.
post string
extra info is posted as a string or list.
post file
extra info specifies a FAT file name; the file content is posted.
[header info Unicode text] Optional. A string that specifies header information for the HTTP
request. The default value is an empty string.
Example
This example loads the document at www.alpineskihouse.com in a new window and adds it to the
History folder.
follow hyperlink (active workbook) address "http://www.alpineskihouse.com" ¬
with new window
Command: get border
Returns the border object for the specified border of the format condition object.
Syntax
get border format condition Required. An expression that returns a format condition object.
which border enumeration Required. The border to be retrieved. Can be one of the following:
inside horizontal
inside vertical
diagonal down
diagonal up
edge bottom
edge left
edge right
edge top
border bottom
border left
border right
border top
Example
This example adds a dotted border around the range E1:E10.
set theFC to make new format condition at range "E1:E10" with properties ¬
{format condition type:cell value, ¬
condition operator:operator between, ¬
formula1:"1", formula2:"10"}
set line style of (get border theFC which border border top) to dot
set line style of (get border theFC which border border bottom) to dot
set line style of (get border theFC which border border left) to dot
set line style of (get border theFC which border border right) to dot
Microsoft Excel Suite
197
Command: get clipboard formats
Returns a list of the formats that are currently on the clipboard.
Syntax
get clipboard formats
Example
This example displays a message box if the Clipboard contains a rich-text format (RTF) object. You
can create an RTF object by copying text from a Word document.
set aFmts to get clipboard formats
repeat with i from 1 to (count of aFmts)
if item i of aFmts is "clipboard format RTF" then
display dialog "Clipboard contains rich text"
end if
end repeat
Command: get custom list contents
Returns a custom list (a list of strings).
Syntax
get custom list contents
list num integer Required. The list number.
Example
This example writes the elements of the first custom list in column one on Sheet1.
set custList to get custom list contents list num 1
repeat with i from 1 to (count of custList)
set value of cell ("A" & i) of worksheet "Sheet1" to (item i of custList)
end repeat
Command: get custom list num
Returns the custom list number for a list of strings. You can use this command to match both built-
in lists and custom-defined lists.
Syntax
get custom list num
list array list Required. A list of strings.
Remarks
This command generates an error if there's no corresponding list.
Microsoft Excel Suite
198
Example
This example deletes a custom list.
set n to (get custom list num list array {"cogs", "sprockets", "widgets", ¬
"gizmos"})
delete custom list list num n
Command: get dialog
Returns the specified dialog object.
Syntax
get dialog enumeration Required. The specific dialog box you want to return. Can be one of the
following:
dialog open
dialog open links
dialog save as
dialog file delete
dialog page setup
dialog print
dialog printer setup
dialog arrange all
dialog window size
dialog window move
dialog run
dialog set print titles
dialog font
dialog display
dialog protect document
dialog calculation
dialog extract
dialog data delete
dialog sort
dialog data series
dialog table
dialog format number
dialog alignment
dialog style
dialog border
dialog cell protection
dialog column width
dialog clear
dialog paste special
dialog edit delete
dialog insert
dialog paste names
dialog define name
dialog create names
dialog formula goto
dialog formula find
dialog change link
dialog app move
dialog app size
dialog main chart type
dialog overlay chart type
dialog open mail
dialog send mail
dialog standard font
dialog consolidate
dialog sort special
dialog gallery threeD area
dialog gallery threeD column
dialog gallery threeD line
dialog gallery threeD pie
dialog view threeD
dialog goal seek
dialog workgroup
dialog fill group
dialog update link
dialog promote
dialog demote
dialog show detail
dialog object properties
dialog save new object
dialog apply style
dialog assign to object
dialog object protection
dialog show toolbar
dialog print preview
dialog edit color
dialog format main
dialog format overlay
dialog edit series
dialog define style
dialog gallery radar
dialog zoom
dialog options general
dialog filter advanced
dialog mail next letter
dialog data label
dialog insert title
dialog font properties
dialog macro options
dialog workbook unhide
dialog workbook name
dialog gallery custom
dialog add chart autoformat
dialog chart add data
dialog tab order
dialog subtotal create
dialog workbook tab split
dialog workbook protect
dialog scrollbar properties
dialog pivot show pages
dialog text to columns
dialog format charttype
dialog pivot field group
dialog pivot field ungroup
dialog checkbox properties
dialog label properties
dialog listbox properties
dialog editbox properties
dialog open text
dialog pushbutton properties
dialog filter
dialog function wizard
dialog save copy as
dialog options lists add
dialog series axes
dialog series x
dialog series y
dialog errorbar x
Microsoft Excel Suite
199
dialog gallery area
dialog gallery bar
dialog gallery column
dialog gallery line
dialog gallery pie
dialog gallery scatter
dialog combination
dialog gridlines
dialog axes
dialog attach text
dialog patterns
dialog main chart
dialog overlay
dialog scale
dialog format legend
dialog format text
dialog parse
dialog unhide
dialog workspace
dialog activate
dialog copy picture
dialog delete name
dialog delete format
dialog new
dialog row height
dialog format move
dialog format size
dialog formula replace
dialog select special
dialog apply names
dialog replace font
dialog split
dialog outline
dialog save workbook
dialog copy chart
dialog format font
dialog note
dialog set update status
dialog color palette
dialog insert object
dialog size
dialog move
dialog format auto
dialog gallery threeD bar
dialog gallery threeD surface
dialog customize toolbar
dialog workbook add
dialog workbook move
dialog workbook copy
dialog workbook options
dialog save workspace
dialog chart wizard
dialog assign to tool
dialog placement
dialog fill workgroup
dialog workbook new
dialog scenario cells
dialog scenario add
dialog scenario edit
dialog scenario summary
dialog pivot table wizard
dialog pivot field properties
dialog options calculation
dialog options edit
dialog options view
dialog add in manager
dialog menu editor
dialog attach toolbars
dialog options chart
dialog vba insert file
dialog vba procedure definition
dialog routing slip
dialog mail logon
dialog insert picture
dialog gallery doughnut
dialog chart trend
dialog workbook insert
dialog options transition
dialog errorbar y
dialog format chart
dialog series order
dialog mail edit mailer
dialog standard width
dialog scenario merge
dialog summary info
dialog find file
dialog active cell font
dialog vba make add in
dialog file sharing
dialog autocorrect
dialog custom views
dialog insert name label
dialog series shape
dialog chart options data labels
dialog chart options data table
dialog set background picture
dialog data validation
dialog chart type
dialog chart location
dialog chart source data
dialog series options
dialog pivot table options
dialog pivot solve order
dialog pivot calculated field
dialog pivot calculated item
dialog conditional formatting
dialog insert hyperlink
dialog protect sharing
dialog phonetic
dialog import text file
dialog calculator
dialog web options general
dialog web options pictures
dialog web options files
dialog web options fonts
dialog web options encoding
Example
The following example displays and carries out the actions taken in the built-in Save As dialog box
(File menu).
show (get dialog dialog save as)
Microsoft Excel Suite
200
Command: get file converters
Returns a list of all of the file converter objects.
Syntax
get file converters list Required. Returns a list of file converters.
Example
This example returns a list of file converters.
get file converters
Command: get FileMaker criteria
Retrieves the criteria from an existing Excel query table that has been created against a FileMaker
database.
Syntax
get FileMaker criteria query table Required. An expression that returns a query table object.
criteria index integer Required. An index into the number of criteria that have been set.
Example
This example returns the values of arguments used in the second set of criteria from an existing
Excel query table that was created against a FileMaker database.
set QT to query table 1 of active sheet
set criteriaRecord to get FileMaker criteria QT criteria index 2
set varfieldName to «class 5324» of criteriaRecord
set varClauseText to «class 5325» of criteriaRecord
set varCondition to «class 5326» of criteriaRecord
set varOperator to operator of criteriaRecord
Command: get international
This command is not currently supported.
Microsoft Excel Suite
201
Command: get list item
Returns a string from the list.
Syntax
get list item listbox/dropdown Required. Returns a string from the list.
[entry index integer] Optional. The index of the string to be returned.
Example
This example returns the string contained in list item 1 of listbox 1 on the active sheet.
get list item listbox 1 of active sheet entry index 1
Command: get open filename
This command is not currently supported.
Command: get pivot table data
Syntax
get pivot table data pivot table Required. An expression that returns a pivot table object.
name Unicode text Required. Describes a single cell in the PivotTable, using syntax similar to
the pivot select command or the PivotTable references in calculated item formulas.
Example
This example shows the sum of revenues for apples in January (Data field = Revenue, Product =
Apples, Month = January).
display dialog (get pivot table data (pivot table 1 of active sheet) ¬
name "'Sum of Revenue' Apples January") as string
Command: get previous selections
This command is not currently supported.
Command: get registered functions
Returns information about functions in code resources that were registered with the REGISTER or
REGISTER.ID macro functions.
Syntax
get registered functions
Microsoft Excel Suite
202
Example
This example creates a list of registered functions, placing one registered function in each row on
Sheet1. Column A contains the full path and file name of the DLL or code resource, column B
contains the function name, and column C contains the argument data type code.
set theList to (get registered functions)
if theList is not "" then
display dialog "No registered functions"
else
repeat with i from 1 to (get count of theList)
repeat with j from 1 to 3
set formula of cell i of column j of worksheet "Sheet1" to ¬
(item j of item 1 of theList)
end repeat
end repeat
end if
Command: get save as filename
Displays the standard Save As dialog box and gets a file name from the user without actually
saving any files.
Syntax
get save as filename
[initial filename Unicode text] Optional. Specifies the suggested file name. If this argument is
omitted, Excel uses the name of the active workbook.
[file filter Unicode text] Optional. A string specifying file filtering criteria. This string is a list of comma-
separated file type codes (for example, "TEXT,XLA5,XLS4"). Spaces are significant and shouldn't be
inserted before or after the comma separators unless they're part of the file type code. If omitted, this
argument defaults to all file types.
[filter index integer] Optional. This argument is not currently supported.
[button text Unicode text] Optional. Specifies the text used for the Save button in the dialog box. If this
argument is omitted, the button text is "Save".
Remarks
This command returns the selected file name or the name entered by the user. The returned name
may include a path specification. Returns false if the user cancels the dialog box.
This command may change the current drive or folder.
Microsoft Excel Suite
203
Example
This example displays the Save As dialog box, with the file filter set to text files. If the user chooses
a file name, the example displays that file name in a message box.
set fileSaveName to get save as filename file filter "TEXT"
if fileSaveName is not "" then
display dialog "Save as " & fileSaveName
end if
Command: get subtotals
Returns subtotals displayed with the specified field. Valid only for non-data fields.
Syntax
get subtotals pivot field Required. Specifies the pivot field.
[subtotal index enumeration] Optional. Specifies the subtotal to be returned. Can be one of the
following:
subtotal automatic
subtotal sum
subtotal count
subtotal average
subtotal max
subtotal min
subtotal product
subtotal count numbers
subtotal standard deviation
subtotal standard deviation p
subtotal variable
subtotal variable p
Subtotals are returned as follows:
1 automatic 7 product
2 sum 8 count nums
3 count 9 StdDev
4 average 10 StdDevp
5 max 11 Var
6 min 12 Varp
Example
get subtotals pivot field 1 of pivot table 1 of active sheet
Microsoft Excel Suite
204
Command: get values
Returns a list that contains the current values of the changing cells for the scenario.
Syntax
get values scenario Required. An expression that returns a scenario object.
Example
This example returns a list that contains the current values of the changing cells for scenario 1.
get values scenario 1 of worksheet "Sheet1"
Command: get visible fields
Returns a list of all of the visible PivotTable fields. Visible PivotTable fields are shown as row,
column, page, or data fields.
Syntax
get visible fields pivot table Required. An expression that returns a pivot table object.
Example
get visible fields pivot table 1 of active sheet
Command: get webpage font
Returns a web page font object for a particular character set.
Syntax
get webpage font enumeration Required. The character set from which you want to return the
web page font object. Can be one of the following:
Arabic character set
Cyrillic character set
English character set
Greek character set
Hebrew character set
Japanese character set
Korean character set
Multilingual Unicode character set
Simplified Chinese character set
Thai character set
Traditional Chinese character set
Vietnamese character set
Example
The following example uses the get webpage font command to set
myFont to the web page font
object for the English character set in the active application.
set myFont to (get webpage font English character set)
Microsoft Excel Suite
205
Command: goto
Selects any range in any workbook, and activates that workbook if it's not already active.
Syntax
goto
[reference range] Optional. The destination. Can be a range object, an A1-style range reference,
a named range, or a list of category names. If this argument is omitted, the destination is the
last range you used the goto command to select.
[scroll Boolean] Optional. True to scroll through the window so that the upper-left corner of the range
appears in the upper-left corner of the window. False to not scroll through the window. The default is
false.
Remarks
This command differs from the select command in the following ways:
If you specify a range on a sheet that's not on top, Excel will switch to that sheet before
selecting. (If you use select with a range on a sheet that's not on top, the range will be
selected but the sheet won't be activated.)
This command has a scroll argument that lets you scroll through the destination window.
When you use the goto command, the previous selection (before the goto command runs) is
added to the list of previous selections. You can use this feature to quickly jump between as
many as four selections.
Example
This example selects cell A154 on Sheet1 and then scrolls through the worksheet to display the
range.
set theRange to range "A154" of worksheet "Sheet1"
goto reference theRange with scroll
Command: help
Displays the Help window.
Syntax
help
[help file Unicode text] Optional. The name of the online Help file to display. If this argument
isn't specified, Excel Help is displayed.
[help context id integer] Optional. Specifies the context ID number for the Help topic to display. If this
argument isn't specified, the default topic for the specified Help file is displayed.
Microsoft Excel Suite
206
Remarks
The help file argument must specify an Office Help file. Otherwise, a "file could not be found"
message appears.
Example
This example displays topic number 1027 in the file Excel Help.
help help file "Excel Help" help context id 1027
Command: highlight changes options
Controls how changes are shown in a shared workbook.
Syntax
highlight changes options workbook Required. An expression that returns a workbook object.
[when enumeration] Optional. The changes that are shown. Can be one of the following: since
my last save, all changes, or not yet reviewed.
[who Unicode text] Optional. The user or users whose changes are shown. Can be "Everyone," "Everyone
but Me," or the name of one of the users of the shared workbook.
[where range object/A1-style range reference/named range] Optional. A range object, A1-style range
reference, or named range that specifies the area to check for changes.
Example
This example shows all changes made to the shared workbook since it was last saved by the current
user.
highlight changes options active workbook when since my last save who "Everyone"
Command: inches to points
Converts a measurement from inches to points.
Syntax
inches to points
inches real Required. Specifies the inch value to be converted to points.
Example
This example sets the left margin of Sheet1 to 2.5 inches.
set left margin of page setup object of worksheet "Sheet1" to ¬
(inches to points inches 2.5)
Microsoft Excel Suite
207
Command: input box
Displays a dialog box for user input. Returns the information entered in the dialog box.
Syntax
input box
prompt Unicode text Required. The message to be displayed in the dialog box. This can be a
string, a number, a date, or a Boolean value (Excel automatically converts the value to a string
before it's displayed).
[title Unicode text] Optional. The title for the input box. If this argument is omitted, the default title is
"Input."
[default range] Optional. Specifies a value that will appear in the text box when the dialog box is initially
displayed. If this argument is omitted, the text box is left empty. Can be a range object, an A1-style range
reference, a named range, or input default as string.
[left position integer] Optional. Specifies an x position (in points) for the dialog box in relation to the
upper-left corner of the screen.
[top integer] Optional. Specifies a y position (in points) for the dialog box in relation to the upper-left
corner of the screen.
[type enumeration] Optional. Specifies the return data type. If this argument is omitted, the dialog box
returns text. Can be one of the following:
a number
input type as string
a number or a string
a bool
range object
list of numbers
list of strings
list of number or string
list of bools
list of range objects
Remarks
Use input box to display a simple dialog box so that you can enter information to be used in a
script. The dialog box has an OK button and a Cancel button. If you choose the OK button, input
box returns the value entered in the dialog box. If you click the Cancel button, input box returns
false.
If type is range object, input box returns a valid range reference as a Unicode text string.
set myRange to (input box prompt "Sample" type range object)
Microsoft Excel Suite
208
If you use the input box command to ask the user for a formula, you must use the formula local
property to assign the formula to a range object. The input formula will be in the language of the
user.
Example
This example prompts the user for a number.
input box prompt "Enter a number"
This example prompts the user to select a cell on Sheet1. Because this example uses the type
argument, it returns a valid range reference as a Unicode text string.
activate sheet "Sheet1"
set myCell to input box prompt "Select a cell" type range object
Command: intersect
Returns a range object that represents the rectangular intersection of two or more ranges. At least
two ranges must be specified.
Syntax
intersect
range1 range Required. One of the intersecting ranges.
range2 range Required. One of the intersecting ranges.
[range3, range4, ... range30 range] Optional. More intersecting ranges.
Example
This example selects the intersection of two ranges on Sheet1 that have defined names, rg1 and rg2.
If the ranges don't intersect, the example displays a message.
set isect to intersect range1 range of named item ¬
"rg1" range2 range of named item "rg2"
select isect
Command: item selected
Checks whether a particular item in the list is selected.
Syntax
item selected listbox/dropdown Required. An expression that returns a listbox or dropdown
object.
[entry index integer] Optional. The index of the string to be checked to see whether it is
selected. Returns true if the item was selected.
Example
item selected listbox 1 of active sheet entry index 1
Microsoft Excel Suite
209
Command: large scroll
Scrolls the contents of the window by pages.
Syntax
large scroll window/pane Required. An expression that returns a window or pane object.
[down integer] Optional. The number of pages to scroll the contents down.
[up integer] Optional. The number of pages to scroll the contents up.
[to right integer] Optional. The number of pages to scroll the contents to the right.
[to left integer] Optional. The number of pages to scroll the contents to the left.
Remarks
If down and up are both specified, the contents of the window are scrolled by the difference of the
arguments. For example, if down is 3 and up is 6, the contents are scrolled up three pages.
If to left and to right are both specified, the contents of the window are scrolled by the difference of
the arguments. For example, if to left is 3 and to right is 6, the contents are scrolled to the right three
pages.
Any of the arguments can be a negative number.
Example
This example scrolls the contents of the active window of Sheet1 down three pages.
large scroll active window down 3
Command: link info
Returns the link date and update status.
Syntax
link info workbook Required. An expression that returns a workbook object.
name Unicode text Required. The name of the link, as returned from the link sources command.
link info enumeration Required. The type of information to be returned. Can be update state or edition
date (applies only to editions). For update state, this command returns 1 if the link updates
automatically, or it returns 2 if the link must be updated manually.
[type enumeration] Optional. The type of link to return. Can be one of the following: link info olelinks,
link info publishers, or link info subscribers.
Example
This example sets cell A1 to "TRUE" if the link is updated automatically.
if (link info active workbook name "Word.Document|Document1" ¬
link info update state type link info olelinks) = 1 then
set value of cell "A1" to "TRUE"
end if
Microsoft Excel Suite
210
Command: link sources
Returns a list of links in the workbook. The names in the list are the names of the linked documents,
editions, or OLE servers. Returns an empty string if there are no links.
Syntax
link sources workbook Required. An expression that returns a workbook object.
[type enumeration] Optional. The type of link to return. Can be either link type Excel links or
link type OLE links.
Remarks
The format of the list is a one-dimensional list for all types. The returned strings contain the name of
the link source in the appropriate notation for the link type.
Command: list formulas
Creates a list of calculated PivotTable items and fields on a separate worksheet.
Syntax
list formulas pivot table Required. An expression that returns a pivot table object.
Example
This example creates a list of calculated items and fields for PivotTable one.
list formulas pivot table 1 of worksheet 1
Command: merge scenarios
Merges the scenarios from the merge source worksheet into this worksheet.
Syntax
merge scenarios worksheet Required. An expression that returns a worksheet object.
merge source worksheet Required. The name of the sheet that contains scenarios to be merged,
or a worksheet object that represents that sheet.
Example
This example merges the styles from the workbook Template.xls into the active workbook.
merge scenarios active workbook merge source workbook "Template.xls"
Microsoft Excel Suite
211
Command: merge workbook
Merges changes from one workbook into an open workbook.
Syntax
merge workbook workbook Required. An expression that returns a workbook object.
file name Unicode text Required. The file name of the workbook that contains the changes to be
merged into the open workbook.
Example
This example merges changes from Book1.xls into the active workbook.
merge workbook active workbook file name "Book1.xls"
Command: modify
Modifies data validation for a range.
Syntax
modify validation Required. An expression that returns a validation object.
[type enumeration] Optional. The validation type. Can be one of the following:
validate input only
validate whole number
validate decimal
validate list
validated date
validate time
validate text length
validate custom
[alert style enumeration] Optional. The validation alert style. Can be one of the following: valid
alert none, valid alert stop, valid alert warning, or valid alert information.
Microsoft Excel Suite
212
[operator enumeration] Optional. The data validation operator. Can be one of the following:
operator between
operator not between
operator equal
operator not equal
operator greater
operator less
operator greater equal
operator less equal
[formula1 Unicode text] Optional. The first part of the data validation equation.
[formula2 Unicode text] Optional. The second part of the data validation when operator is operator
between or operator not between (otherwise, this argument is ignored).
Remarks
The modify command requires different arguments depending on the validation type, as shown in
the following table.
Validation type Arguments
validate custom
formula1 is required; formula2 is ignored. formula1 must
contain an expression that evaluates to true when data
entry is valid and false when data entry is invalid.
validate input only
alert style, formula1, and formula2 are not used.
validate list
formula1 is required; formula2 is ignored. formula1 must
contain either a comma-delimited list of values or a
worksheet reference to the list.
validate whole number, validated
date, validate decimal, validate text
length, or validate time
formula1 or formula2, or both, must be specified.
Example
This example changes data validation for cell E5.
set v1 to validation of range "E5"
modify v1 type validate list alert style valid alert stop ¬
formula1 "=$A$1:$A$10"
Microsoft Excel Suite
213
Command: modify condition
Modifies an existing conditional format.
Syntax
modify condition format condition Required. An expression that returns a format condition
object.
type enumeration Required. Specifies whether the conditional format is based on a cell value or
an expression. Can be either cell value or expression.
[operator enumeration] Optional. The conditional format operator. Can be one of the following:
operator between
operator not between
operator equal
operator not equal
operator greater
operator less
operator greater equal
operator less equal
[formula1 Unicode text] Optional. The value or expression associated with the conditional
format. Can be a constant value, a string value, a cell reference, or a formula.
[formula2 Unicode text] Optional. The value or expression associated with the second part of the
conditional format when operator is operator between or operator not between. Can be a constant value,
a string value, a cell reference, or a formula.
Note If type is expression, then operator is ignored and formula1 is required. If type is cell value, then
operator and formula1 are required.
Example
These examples modify an existing conditional format for the current selection.
set theFC to make new format condition at range "E1:E10" ¬
with properties {format condition type:cell value, ¬
condition operator:operator between, formula1:"1", ¬
formula2:"10"}
modify condition theFC type cell value ¬
operator operator equal formula1 "3.5"
set theFC to make new format condition at range "E1:E10" ¬
with properties {format condition type:cell value, ¬
condition operator:operator between, formula1:"1", ¬
formula2:"10"}
modify condition theFC type expression formula1 "=SUM(A1:A5)"
Command: new window on workbook
Creates a new window or a copy of the specified workbook window.
Syntax
new window on workbook workbook Required. An expression that returns a workbook object.
Microsoft Excel Suite
214
Example
This example creates a new window for the active workbook.
new window on workbook active workbook
Command: next Excel comment
Returns an Excel comment object that represents the next comment.
Syntax
next Excel comment Excel comment Required. An expression that returns an Excel comment
object.
Remarks
This command works only on one sheet. Using this command on the last comment on a sheet
returns missing value (not the next comment on the next sheet).
Example
This example hides the next comment.
set visible of (next Excel comment ¬
(Excel comment of range "A1")) to false
Command: on key
Runs a specified procedure when a particular key or key combination is pressed.
Syntax
on key
key string Required. A string indicating the key to be pressed.
[command key pressed Boolean] Optional. Specifies whether the COMMAND key must be pressed with
the key specified by the key argument.
[shift key pressed Boolean] Optional. Specifies whether the SHIFT key must be pressed with the key
specified by the key argument.
[option key pressed Boolean] Optional. Specifies whether the OPTION key must be pressed with the key
specified by the key argument.
[control key pressed Boolean] Optional. Specifies whether the CONTROL key must be pressed with the
key specified by the key argument.
[procedure script] Optional. A string indicating the name of the procedure to be run. If procedure is ""
(empty text), nothing happens when key is pressed. This form of the on key command changes the
normal result of keystrokes in Excel. If procedure is omitted, key reverts to its normal result in Excel, and
any special key assignments made with previous on key commands are cleared.
Microsoft Excel Suite
215
Remarks
The key argument can specify any single keyCOMMAND, CTRL, OPTION, or SHIFT, or any
combination of these keys. Each key is represented by one or more characters, such as
"a" for the
character a, or
"{RETURN}" for the RETURN key.
To specify characters that aren't displayed when you press the corresponding key (ENTER or TAB,
for example), use the codes listed in the following table. Each code in the table represents one key on
the keyboard.
Key Code
BACKSPACE
{BACKSPACE} or {BS}
BREAK
{BREAK}
CAPS LOCK
{CAPSLOCK}
CLEAR
{CLEAR}
DELETE or DEL
{DELETE} or {DEL}
DOWN ARROW
{DOWN}
END
{END}
ENTER (numeric keypad)
{ENTER}
ENTER
~ (tilde)
ESC {
ESCAPE} or {ESC}
HELP
{HELP}
HOME
{HOME}
INS
{INSERT}
LEFT ARROW
{LEFT}
NUM LOCK
{NUMLOCK}
PAGE DOWN
{PGDN}
PAGE UP
{PGUP}
RETURN
{RETURN}
RIGHT ARROW
{RIGHT}
SCROLL LOCK
{SCROLLLOCK}
TAB
{TAB}
UP ARROW
{UP}
F1 through F15
{F1} through {F15}
Microsoft Excel Suite
216
You can also specify keys combined with SHIFT and/or CTRL and/or OPTION and/or
COMMAND. To specify a key combined with another key or keys, use the following table.
To combine keys with Precede the key code by
SHIFT
+ (plus sign)
CTRL
^ (caret)
OPTION
% (percent sign)
COMMAND
* (asterisk)
To assign a procedure to one of the special characters (+, ^, %, and so on), enclose the character in
braces. For details, see the example.
Example
This example assigns "InsertProc" to the key sequence CTRL+PLUS SIGN and assigns
"SpecialPrintProc" to the key sequence SHIFT+CTRL+RIGHT ARROW.
on key key "+" control key pressed true procedure "InsertProc"
on key key "RIGHT" shift key pressed true control key pressed true ¬
procedure "SpecialPrintProc"
This example returns SHIFT+CTRL+RIGHT ARROW to its normal meaning.
on key key "RIGHT" shift key pressed true control key pressed true
This example disables the SHIFT+CTRL+RIGHT ARROW key sequence.
on key key "RIGHT"
Command: on repeat
Sets the Repeat menu item and the name of the procedure that will run if you choose the Repeat
command (Edit menu) after running the procedure that sets this property.
Syntax
on repeat
display text Unicode text Required. The text that appears with the Repeat command (Edit
menu).
procedure Unicode text Required. The name of the procedure that will be run when you choose the Repeat
command (Edit menu).
Remarks
If a procedure doesn't use the on repeat command, the Repeat menu item repeats the procedure
that was run most recently.
The procedure must use the on repeat command last to prevent the Repeat menu item from being
overwritten by subsequent actions in the procedure.
Microsoft Excel Suite
217
Example
This example sets the repeat procedure.
on repeat display text "Repeat VB Procedure" ¬
procedure "Book1.xls!My_Repeat_Sub"
Command: open FileMaker file
Opens the FileMaker Import Wizard for importing data from a FileMaker database into Excel.
Syntax
open FileMaker file
filename Unicode text Required. The path and name of the FileMaker file.
Example
This example opens a file named "Inventory.fp6" in the FileMaker Import Wizard.
open FileMaker file filename "Inventory.fp6"
Command: open links
Opens the supporting documents for a link or links.
Syntax
open links workbook Required. An expression that returns a workbook object.
name Unicode text Required. The name of the Excel or OLE link, as returned from the link
sources command.
[read only Boolean] Optional. True to open documents as read-only. The default value is false.
[type enumeration] Optional. The link type. Can be link type Excel links or link type OLE links.
Example
This example opens OLE link one in the active workbook.
set linkList to (link sources active workbook type link type OLE links)
open links active workbook name item 1 of linkList
This example opens all supporting Excel documents for the active workbook.
open links active workbook name item 1 of ¬
(link sources active workbook type link type Excel links)
Microsoft Excel Suite
218
Command: open text file
Loads and parses a text file as a new workbook with a single sheet that contains the parsed text-file
data.
Syntax
open text file
filename Unicode text Required. Specifies the file name of the text file to be opened and parsed.
[origin enumeration] Optional. Specifies the origin of the text file. Can be one of the following: Macintosh,
MSWindows, or MSDos. If this argument is omitted, the command uses the current setting of the File
Origin option in the Text Import Wizard.
[start row integer] Optional. The row number at which to start parsing text. The default value is 1.
[data type enumeration] Optional. Specifies the column format of the data in the file. Can be one of the
following: delimited or fixed width. The default value is delimited.
[text qualifier enumeration] Optional. Specifies the text qualifier. Can be one of the following: text
qualifier double quote, text qualifier single quote, or text qualifier none. The default value is text
qualifier double quote.
[consecutive delimiter Boolean] Optional. True to have consecutive delimiters considered one delimiter.
The default is false.
[tab Boolean] Optional. True to have the tab character be the delimiter (data type must be delimited). The
default value is false.
[semicolon Boolean] Optional. True to have the semicolon character be the delimiter (data type must be
delimited). The default value is false.
[comma Boolean] Optional. True to have the comma character be the delimiter (data type must be
delimited). The default value is false.
[space Boolean] Optional. True to have the space character be the delimiter (data type must be delimited
).
The default value is false.
[use other Boolean] Optional. True to have the character specified by the other char argument be the
delimiter (data type must be delimited). The default value is false.
[other char Boolean] Optional (required if use other is true). Specifies the delimiter character when use
other is true. If more than one character is specified, only the first character of the string is used; the
remaining characters are ignored.
Microsoft Excel Suite
219
[field info list] Optional. A list containing parse information for individual columns of data. The
interpretation depends on the value of data type.
When the data is delimited, this argument is a list of two-element list entries, with each two-
element list entry specifying the conversion options for a particular column. The first element
is the column number (1-based), and the second element is one of the following numbers,
specifying how the column in parsed.
1 General
2 Text
3 MDY date
4 DMY date
5 YMD date
6 MYD date
7 DYM date
8 YDM date
9 Skip the column
The column specifiers can be in any order. If there's no column specifier for a particular
column in the input data, the column is parsed with the General setting. This example causes
the third column to be skipped, the first column to be parsed as text, and the remaining
columns in the source data to be parsed with the General setting.
{{3,9}, {1,2}}
If the source data has fixed-width columns, the first element in each two-element list entry
specifies the position of the starting character in the column (as an integer; character 0 (zero) is
the first character). The second element in the two-element list entry specifies the parse option
for the column as a number between 1 and 9, as listed in the preceding table.
The following example parses two columns from a fixed-width text file. The first column
includes characters 1 through 10. Characters 11, 12, 13, 14, and 15 are skipped. The second
column includes character 16 through the last character in the line.
{{0,1}, {10,9}, {15,1}}
[decimal separator Unicode text] Optional. A string specifying whether a comma or period is
used in the text file as the separator for decimal numbers.
[thousands separator Unicode text] Optional. A string specifying whether a comma, period, or apostrophe
is used in the text file as the separator for thousands.
Example
This example opens the file Data.txt and uses tab delimiters to parse the text file into a worksheet.
open text file filename "DATA.TXT" data type delimited tab true
Microsoft Excel Suite
220
Command: open workbook
Opens a workbook.
Syntax
open workbook
workbook file name Unicode text Required. The file name of the workbook to be opened.
[update links enumeration] Optional. Specifies the way links in the file are updated. If this argument is
omitted, the user is prompted to specify how links will be updated. Otherwise, this argument can be one
of the following:
do not update links
update external links only
update remote links only
update remote and external links
If Excel is opening a file in the WKS, WK1, or WK3 format and the update links argument is
update remote links only, Excel generates charts from the graphs attached to the file. If the
argument is do not update links, no charts are created.
[read only Boolean] Optional. True to open the workbook in read-only mode.
[format enumeration] Optional. If Excel is opening a text file, this argument specifies the delimiter
character. If this argument is omitted, the current delimiter is used. Can be one of the following:
tab delimiter
commas delimiter
spaces delimiter
semicolon delimiter
no delimiter
custom character delimiter (see the delimiter argument)
[password Unicode text] Optional. A string that contains the password required to open a
protected workbook. If this argument is omitted and the workbook requires a password, the
user is prompted for the password.
[write reserved password Unicode text] Optional. A string that contains the password required to write to
a write-reserved workbook. If this argument is omitted and the workbook requires a password, the user
will be prompted for the password.
[ignore read only recommended Boolean] Optional. True to have Excel not display the read-only
recommended message (if the workbook was saved with the Read-Only Recommended option).
[origin enumeration] Optional. If the file is a text file, this argument indicates where it originated (so that
code pages and Carriage Return/Line Feed (CR/LF) can be mapped correctly). Can be one of the
following: Macintosh, MSWindows, or MSDos. If this argument is omitted, Macintosh is used.
Microsoft Excel Suite
221
[delimiter Unicode text] Optional. If the file is a text file and the format argument is custom character
delimiter, this argument is a string that specifies the character to be used as the delimiter. For example,
use Chr(9) for tabs, use "," for commas, use ";" for semicolons, or use a custom character. Only the first
character of the string is used.
[editable Boolean] Optional. If the file is an Excel 4.0 add-in, this argument is true to open the add-in so
that it's a visible window. If this argument is false or omitted, the add-in is opened as hidden, and it
cannot be unhidden. This option doesn't apply to add-ins created in Excel 5.0 or later. If the file isn't an
add-in, true prevents any Auto_Open macros from running.
[notify Boolean] Optional. If the file cannot be opened in read/write mode, this argument is true to add the
file to the file notification list. Excel will open the file as read-only, poll the file notification list, and then
notify the user when the file becomes available. If this argument is false or omitted, no notification is
requested, and any attempts to open an unavailable file will fail.
[converter integer] Optional. This argument is not currently supported.
[add to mru Boolean] Optional. True to add this workbook to the list of recently used files. The default
value is false.
Remarks
If the workbook being opened has any Auto_Open macros in it, they won't be run when you open
the workbook by using this command. To run the Auto_Open macro, use the run auto macros
command.
Example
This example opens the workbook Analysis.xls and then runs its Auto_Open macro.
open workbook workbook file name "Analysis.xls"
run auto macros active workbook which auto open
Command: paste special on worksheet
Pastes the contents of the Clipboard onto the sheet, using a specified format. Use this command to
paste data from other applications or to paste data in a specific format.
Syntax
paste special on worksheet sheet Required. An expression that returns a sheet object.
[format Unicode text] Optional. A string that specifies the Clipboard format of the data.
[link Boolean] Optional. True to establish a link to the source of the pasted data. If the source data isn't
suitable for linking or the source application doesn't support linking, this parameter is ignored. The
default value is False.
[display as icon Boolean] Optional. True to display the pasted as an icon. The default value is False.
[icon file name Unicode text] Optional. The name of the file that contains the icon to use if display as icon
is True.
[icon index integer] Optional. The index number of the icon within the icon file.
Microsoft Excel Suite
222
[icon label Unicode text] Optional. The text label of the icon.
[no HTML formatting Boolean] Optional. True to remove all formatting, hyperlinks, and images from
HTML when pasted onto a worksheet. False to paste HTML as is. The default value is False.
Remarks
You must select the destination range before you use this command.
This command may modify the sheet selection, depending on the contents of the Clipboard.
Example
This example pastes a Microsoft Word document object from the Clipboard to cell D1 on Sheet1.
select sheet "Sheet1"
select range "D1"
paste special on worksheet active sheet ¬
format "Microsoft Word 8.0 Document Object"
This example pastes the same Microsoft Word document object and displays it as an icon.
paste special on worksheet active sheet ¬
format "Microsoft Word 8.0 Document Object" ¬
with display as icon
Command: paste worksheet
Pastes the contents of the Clipboard onto the sheet.
Syntax
paste worksheet sheet Required. An expression that returns a sheet object.
[destination range] Optional. A range that specifies where the Clipboard contents should be
pasted. Can be a range object, an A1-style range reference, or a named range. If this argument
is omitted, the current selection is used. This argument can be specified only if the contents of
the Clipboard can be pasted into a range. If this argument is specified, the link argument
cannot be used.
[link Boolean] Optional. True to establish a link to the source of the pasted data. If this argument is
specified, the destination argument cannot be used. The default value is false.
Remarks
If you don't specify the destination argument, you must select the destination range before you use
this command.
This command may modify the sheet selection, depending on the contents of the Clipboard.
Example
This example copies data from cells C1:C5 on Sheet1 to cells D1:D5 on Sheet1.
select sheet "Sheet1"
copy range range "C1:C5"
paste worksheet sheet "Sheet1" destination range "D1:D5"
Microsoft Excel Suite
223
Command: pivot select
Selects part of a PivotTable.
Syntax
pivot select pivot table Required. An expression that returns a pivot table object.
name Unicode text Required. The selection, in standard PivotTable selection format (see below).
mode enumeration Required. Specifies the structured selection mode. Can be one of the following:
selection mode label only
selection mode data and label
selection mode data only
selection mode origin
selection mode button
selection mode blanks
Standard PivotTable selection format
A string expression used to specify part of a PivotTable.
You can refer to a particular cell only if the PivotTable selection string contains the names of all the
items used to identify individual cells in the selection. The number of items in that string should be
equal to the number of fields in the view for a cell in a normal data area. If the cell is used in
calculating a subtotal or grand total, the number of items in the string would be fewer (including 0
[zero] for the intersection of the column and row grand totals).
The item names in the string can appear in any order. If an item name is ambiguous because it
appears in another field as well, it must be qualified by "Field[Item]." If an item name contains
symbols and spaces, or if it doesn't start with an alphabetical character, it should be enclosed in
single quotation marks. If an item name contains embedded single quotation marks, each of these
marks must be converted to two single quotation marks. Quotation marks aren't required for spaces
if the name is unambiguous, and they're not required for unqualified names that begin with
numbers.
Example
This example selects all date labels in PivotTable one.
pivot select (pivot table 1 of worksheet 1) name "date[ALL]" ¬
mode selection mode label only
Microsoft Excel Suite
224
Command: previous Excel comment
Returns an Excel comment object that represents the previous comment.
Syntax
previous Excel comment Excel comment Required. An expression that returns an Excel comment
object.
Remarks
This command works only on one sheet. Using this command on the first comment on a sheet
returns missing value (not the last comment on the previous sheet).
Example
This example hides the previous comment.
set visible of (previous Excel comment ¬
(Excel comment of range "A1")) to false
Command: print out
Prints the object.
Syntax
print out window/sheet/workbook Required. An expression that returns a window, sheet, or
workbook object.
[from integer] Optional. The number of the page at which to start printing. If this argument is
omitted, printing starts at the beginning.
[to integer] Optional. The number of the last page to print. If this argument is omitted, printing ends with
the last page.
[copies integer] Optional. The number of copies to print. If this argument is omitted, one copy is printed.
[preview Boolean] Optional. True to have Excel invoke print preview before printing the object. False (or
omitted) to print the object immediately.
[active printer Unicode text] Optional. This argument is not currently supported.
[print to file Boolean] Optional. This argument is not currently supported.
[collate Boolean] Optional. True to collate multiple copies.
Remarks
"Pages" in the descriptions of from and to refers to printed pages, not overall pages in the sheet or
workbook.
This command applies to the window object only when it's the Info window.
Example
This example prints the active sheet.
print out active sheet
Microsoft Excel Suite
225
Command: print preview
Shows a preview of the object as it would look when printed.
Syntax
print preview window/sheet/workbook Required. An expression that returns a window, sheet,
or workbook object.
[enable changes Boolean] Optional. Controls access to the Page Setup dialog box and the ability
to change margins from the Preview window by enabling or disabling the Setup and Margins
buttons, respectively.
Example
This example displays Sheet1 in print preview.
print preview sheet "Sheet1"
Command: protect sharing
Saves the workbook and protects it for sharing.
Syntax
protect sharing workbook An expression that returns a workbook object.
[file name Unicode text] Optional. A string indicating the name of the saved file. You can
include a full path; if you don't, Excel saves the file in the current folder.
[password Unicode text] Optional. A case-sensitive string indicating the protection password to be given to
the file. Should be no longer than 15 characters.
[write reserved password Unicode text] Optional. A string indicating the write-reservation password for
this file. If a file is saved with the password and the password isn't supplied when the file is opened, the
file is opened read-only.
[read only recommended Boolean] Optional. True to display a message when the file is opened
recommending that the file be opened read-only.
[create backup Boolean] Optional. True to create a backup file.
[sharing password Unicode text] Optional. A string indicating the password to be used to protect the file
for sharing.
Example
This example saves workbook one and protects it for sharing.
protect sharing active workbook password "drowssap" ¬
sharing password "gnirahs"
Microsoft Excel Suite
226
Command: protect workbook
Protects a workbook so that it cannot be modified.
Syntax
protect workbook workbook Required. An expression that returns a workbook object.
[password Unicode text] Optional. A string that specifies a case-sensitive password for the
workbook. If this argument is omitted, you can unprotect the workbook without using a
password. Otherwise, you must specify the password to unprotect the workbook. If you forget
the password, you cannot unprotect the workbook. It's a good idea to keep a list of your
passwords and their corresponding document names in a safe place.
[structure Boolean] Optional. True to protect the structure of the workbook (the relative position of the
sheets). The default value is false.
[windows Boolean] Optional. True to protect the workbook windows. If this argument is omitted, the
windows aren't protected.
Example
This example protects the active workbook.
protect workbook active workbook password "drowssap"
Command: protect worksheet
Protects a worksheet so that it cannot be modified.
Syntax
protect worksheet worksheet Required. An expression that returns a worksheet object.
[password Unicode text] Optional. A string that specifies a case-sensitive password for the
sheet. If this argument is omitted, you can unprotect the sheet without using a password.
Otherwise, you must specify the password to unprotect the sheet. If you forget the password,
you cannot unprotect the sheet. It's a good idea to keep a list of your passwords and their
corresponding document names in a safe place.
[drawing objects Boolean] Optional. True to protect shapes. The default value is false.
[worksheet contents Boolean] Optional. True to protect contents. For a chart, this protects the entire chart.
For a worksheet, this protects the individual cells. The default value is true.
[scenarios Boolean] Optional. True to protect scenarios. This argument is valid only for worksheets. The
default value is true.
[user interface only Boolean] Optional. True to protect the user interface, but not macros. If this argument
is omitted, protection applies both to macros and to the user interface.
Microsoft Excel Suite
227
Remarks
If you apply the protect worksheet command with the user interface only argument set to true to a
worksheet and then save the workbook, the entire worksheet (not just the interface) will be fully
protected when you reopen the workbook. To unprotect the worksheet but re-enable user interface
protection after the workbook is opened, you must again apply the protect worksheet command
with user interface only set to true.
Example
This example protects the active worksheet.
protect worksheet active sheet password "drowssap"
Command: purge change history now
Removes entries from the change log for the specified workbook.
Syntax
purge change history now workbook An expression that returns a workbook object.
days integer Required. The number of days that changes in the change log are to be retained.
[sharing password Unicode text] Optional. The password that removes protection from the workbook for
sharing. If the workbook is protected for sharing with a password and this argument is omitted, the user
is prompted for the password.
Example
This example removes all changes that are more than one day old from the change log for the active
workbook.
purge change history now active workbook days 1
Command: refresh
Updates the PivotTable cache.
Syntax
refresh pivot cache Required. An expression that returns a pivot cache object.
Example
This example refreshes the PivotTable.
refresh pivot cache of pivot table 1 of sheet 1
Microsoft Excel Suite
228
Command: refresh all
Refreshes all external data ranges and PivotTables in the workbook.
Syntax
refresh all workbook Required. An expression that returns a workbook object.
Remarks
The refresh order is undefined.
Example
This example refreshes all external data ranges and PivotTables in the workbook.
refresh all active workbook
Command: refresh query table
Updates the query table.
Syntax
refresh query table query table Required. An expression that returns a query table object.
[background query Boolean] Optional. Used only with query tables. True to return control to
the procedure as soon as a database connection is made and the query is submitted (the query
is updated in the background). False to return control to the procedure only after all data has
been fetched to the worksheet. If this argument isn't specified, the setting of the background
query property of the query table object determines the query mode.
Remarks
The refresh query table command causes Excel to connect to the query table's data source, execute
the SQL query, and return data to the query table destination range. Until this command is called,
the query table doesn't communicate with the data source.
When making the connection to the ODBC data source, Excel uses the connection string specified by
the connection property of the query table object. If the specified connection string is missing
required values, the ODBC driver manager or the ODBC driver (or both) will display modal dialog
boxes to prompt the user for the required information. If the display alerts property of the
application object is false, dialog boxes aren't displayed and the refresh query table command fails
with an Insufficient Connection Information exception.
After Excel makes a successful connection, it stores the completed connection string so that prompts
won't be displayed for subsequent calls to the refresh query table command during the same
editing session. You can obtain the completed connection string by examining the value of the
connection property.
After the database connection is made, the SQL query is validated. If the query isn't valid, the
refresh query table command fails with the SQL Syntax Error exception.
Microsoft Excel Suite
229
If the query requires parameters, the parameters must have been initialized with parameter binding
information. If not enough parameters have been bound, the refresh query table command fails
with the Parameter Error exception. If parameters are set to prompt for their values, dialog boxes
are displayed to the user regardless of the setting of the display alerts property. If the user cancels a
parameter dialog box, the refresh query table command halts and returns false. If there are extra
parameters bound, the extra parameters are ignored.
The refresh query table command returns true if the query is successfully completed or started; it
returns false if the user cancels a connection or parameter dialog box.
To see whether the number of fetched rows exceeded the number of available rows on the
worksheet, examine the fetched row overflow property of the query table object. This property is
initialized every time the refresh query table command is called.
Example
This example refreshes query table 1 in worksheet 1.
refresh query table query table 1 of sheet 1
Command: refresh table
Refreshes the PivotTable from the source data. Returns true if it's successful.
Syntax
refresh table pivot table Required. An expression that returns a pivot table object.
Example
This example refreshes the PivotTable.
set pvtTable to pivot table of range "A3" of sheet "Sheet3"
refresh pvtTable
Command: register xll
Loads an XLL code resource and automatically registers the functions and commands contained in
the resource.
Syntax
register xll
filename Unicode text Required. Specifies the name of the XLL file to be loaded.
Remarks
This command returns true if the code resource is successfully loaded; otherwise, the command
returns false.
Example
This example loads an XLL file and registers the functions and commands in the file.
register xll filename "XLMAPI.XLL"
Microsoft Excel Suite
230
Command: reject all changes
Rejects all changes in the specified shared workbook.
Syntax
reject all changes workbook Required. An expression that returns a workbook object.
[when Unicode text] Optional. Specifies when all the changes are rejected.
[who Unicode text] Optional. Specifies by whom all the changes are rejected.
[where Unicode text] Optional. Specifies where all the changes are rejected.
Example
This example rejects all changes in the active workbook.
reject all changes active workbook
Command: remove all items
Removes all entries from an Excel list box or combo box.
Syntax
remove all items listbox/dropdown Required. An expression that returns a listbox or dropdown
object.
Example
This example removes all items from a list box.
remove all items listbox 1 of sheet 1
Command: remove item
Removes one or more items from a list box or combo box.
Syntax
remove item listbox/dropdown Required. An expression that returns a listbox or dropdown
object.
entry index integer Required. The number of the first item to be removed. Valid values are from
1 to the number of items in the list (returned by the number of items in list property of the
listbox or dropdown object).
[count integer] Optional. The number of items to be removed, starting at item entry index. If this argument
is omitted, one item is removed. If entry index + count exceeds the number of items in the list, all items
from entry index through the end of the list are removed without an error.
Microsoft Excel Suite
231
Remarks
If the specified object has a fill range defined for it, this command fails.
To remove all entries from an Excel list box or combo box, use the remove all items command.
Example
This example removes the selected item from a list box.
remove item listbox 1 of sheet 1 entry index 1
Command: remove user
Disconnects the specified user from the shared workbook.
Syntax
remove user workbook Required. An expression that returns a workbook object.
entry index integer Required. The user index.
Example
This example disconnects user two from the shared workbook.
remove user workbook 2 entry index 2
Command: reset all page breaks
Resets all page breaks on the specified worksheet.
Syntax
reset all page breaks sheet Required. An expression that returns a sheet object.
Example
This example resets all page breaks on worksheet one.
reset all page breaks sheet 1
Command: reset colors
Resets the color palette to the default colors.
Syntax
reset colors workbook Required. An expression that returns a workbook object.
Example
This example resets the color palette in the active workbook.
reset colors active workbook
Microsoft Excel Suite
232
Command: run auto macros
Runs the Auto_Open, Auto_Close, Auto_Activate, or Auto_Deactivate macro attached to the
workbook.
Syntax
run auto macros workbook Required. An expression that returns a workbook object.
which enumeration Required. The macros to run. Can be one of the following:
Value Description
auto open
Auto_Open macros
auto close
Auto_Close macros
auto activate
Auto_Activate macros
auto deactivate
Auto_Deactivate macros
Example
This example opens the workbook Analysis.xls and then runs its Auto_Open macro.
open workbook workbook file name "ANALYSIS.XLS"
run auto macros active workbook which auto close
This example runs the Auto_Close macro for the active workbook and then closes the workbook.
run auto macros active workbook which auto close
close active workbook
Command: run VB Macro
Runs a Visual Basic macro or calls a function. This can be used to run a macro written in Visual
Basic or the Excel 4.0 macro language, or to run a function in a DLL or XLL.
Syntax
run VB macro range Optional for application, required for range. An expression that returns the
application that contains the VB macro, or a range on a macro sheet that contains an Excel 4.0 macro.
Can be a range object, an A1-style range reference, a named range, or the name of the VB macro to
run.
[arg1, arg2, ... arg30 anything] Optional. The arguments that should be passed to the function.
Remarks
You cannot use named arguments with this command. Arguments must be passed by position.
The run VB macro command returns whatever the called VB macro returns. Range objects passed
as arguments to the VB macro are converted to values (by applying the value property to the range
object).
Microsoft Excel Suite
233
Example
This example shows how to call the function macro My_Func_Sum, which is defined on the macro
sheet Mycustom.xlm (the macro sheet must be open). The function takes two numeric arguments (1
and 5, in this example).
set mySum to run VB Macro "MYCUSTOM.XLM!My_Func_Sum" arg1 1 arg2 5
display dialog "Macro result: " & mySum
Command: save as
Saves changes to the sheet in a different file.
Syntax
save as sheet Required. An expression that returns a sheet object.
filename Unicode text Required. A string that indicates the name of the file to be saved. You can
include a full path; if you don't, Excel saves the file in the current folder.
[file format enumeration] Optional. The file format to use when you save the file.
The following formats are available only in the Japanese version of Excel: WJ2WD1 file
format, Excel 2 east asian file format, and works 2 east asian file format.
Can be one of the following:
add in file format
CSV file format
CSV Mac file format
CSV MSDos file format
CSV Windows file format
DBF2 file format
DBF3 file format
DBF4 file format
DIF file format
Excel2 file format
Excel 2 east asian file format
Excel3 file format
Excel4 file format
Excel 4 workbook file format
Excel7 file format
Excel 9795 file format
international add in file format
international macro file format
workbook normal file format
SYLK file format
template file format
current platform text file format
text Mac file format
text MSDos file format
text printer file format
text windows file format
WJ2WD1 file format
Works1 file format
Works 1 all file format
Works 1 fmt file format
Works3 file format
Works 3 fm 3 file format
Works4 file format
works file format
works 2 east asian file format
WQ1 file format
WJ3 file format
WJ3FJ3 file format
HTML file format
XML spreadsheet file format
Microsoft Excel Suite
234
[password Unicode text] Optional. A case-sensitive string (no more than 15 characters) that
indicates the protection password to be given to the file.
[write reservation password Unicode text] Optional. A string that indicates the write-reservation password
for this file. If a file is saved with the password and the password isn't supplied when the file is opened,
the file is opened as read-only.
[read only recommended Boolean] Optional. True to display a message when the file is opened,
recommending that the file be opened as read-only.
[create backup Boolean] Optional. True to create a backup file.
[add to most recently used list Boolean] Optional. True to add this workbook to the list of recently used
files. The default value is false.
Example
This example creates a new workbook, prompts the user for a file name, and then saves the
workbook.
set newBook to make new workbook
set fName to get save as filename
save as (worksheet "Sheet1" of newBook) filename fName
Command: save workbook as
Saves changes to the workbook in a different file.
Syntax
save workbook as workbook Required. An expression that returns a workbook object.
[filename Unicode text] Optional. A string that indicates the name of the file to be saved. You
can include a full path; if you don't, Excel saves the file in the current folder.
Microsoft Excel Suite
235
[file format enumeration] Optional. The file format to use when you save the file.
The following formats are available only in the Japanese version of Excel: WJ2WD1 file
format, Excel 2 east asian file format, and works 2 east asian file format.
Can be one of the following:
add in file format
CSV file format
CSV Mac file format
CSV MSDos file format
CSV Windows file format
DBF2 file format
DBF3 file format
DBF4 file format
DIF file format
Excel2 file format
Excel 2 east asian file format
Excel3 file format
Excel4 file format
Excel 4 workbook file format
Excel7 file format
Excel 9795 file format
international add in file format
international macro file format
workbook normal file format
SYLK file format
template file format
current platform text file format
text Mac file format
text MSDos file format
text printer file format
text windows file format
WJ2WD1 file format
Works1 file format
Works 1 all file format
Works 1 fmt file format
Works3 file format
Works 3 fm 3 file format
Works4 file format
works file format
works 2 east asian file format
WQ1 file format
WJ3 file format
WJ3FJ3 file format
HTML file format
XML spreadsheet file format
[password Unicode text] Optional. A case-sensitive string (no more than 15 characters) that
indicates the protection password to be given to the file.
[write reservation password Unicode text] Optional. A string that indicates the write-reservation password
for this file. If a file is saved with the password and the password isn't supplied when the file is opened,
the file is opened as read-only.
[read only recommended Boolean] Optional. True to display a message when the file is opened
recommending that the file be opened as read-only.
[create backup Boolean] Optional. True to create a backup file.
[access mode enumeration] Optional. The workbook access mode. Can be one of the following: shared
(shared list), exclusive (exclusive mode), or no change (don't change the access mode). If this argument is
omitted, the access mode isn't changed. This argument is ignored if you save a shared list without
changing the file name. To change the access mode, use the exclusive access command.
[conflict resolution enumeration] Optional. Specifies the way change conflicts are resolved if the workbook
is a shared list. Can be one of the following: user resolution (display the conflict-resolution dialog box),
local session changes (automatically accept the local user's changes), or other session changes (accept
other changes instead of the local user's changes). If this argument is omitted, the conflict-resolution
dialog box is displayed.
[add to most recently used list Boolean] Optional. True to add this workbook to the list of recently used
files. The default value is false.
Microsoft Excel Suite
236
Example
This example creates a new workbook, prompts the user for a file name, and then saves the
workbook.
set newBook to make new workbook
set fName to get save as filename
save workbook as newBook filename fName
Command: save workspace
Saves the current workspace.
Syntax
save workspace
[workspace file name Unicode text] Optional. The saved file name.
Example
This example saves the current workspace as "saved workspace.xlw". Before you run this example
the workbook must be saved.
save workspace workspace file name "saved workspace.xlw"
Command: scroll workbook tabs
Scrolls through the workbook tabs at the bottom of the window. Does not affect the active sheet in
the workbook.
Syntax
scroll workbook tabs window Required. An expression that returns a window object.
[sheets integer] Optional. The number of sheets to scroll by. To scroll forward, use a positive
number; to scroll backward, use a negative number; to not scroll at all, use 0 (zero). You must
specify sheets if you don't specify position.
[position enumeration] Optional. To scroll to the first sheet, use scroll tab position first; to scroll to the last
sheet, use scroll tab position last. You must specify position if you don't specify sheets.
Example
This example scrolls through the workbook tabs to the last sheet in the workbook.
scroll workbook tabs active window position scroll tab position last
Microsoft Excel Suite
237
Command: send to back
Sends the object to the back of the z-order.
Syntax
send to back button/checkbox/option
button/scrollbar/listbox/groupbox/dropdown/spinner/label/textbox Required. An expression
that returns one of the listed objects.
Example
This example sends button 1 on Sheet1 to the back of the z-order.
send to back button 1 of sheet "Sheet1"
Command: set background picture
Sets the background graphic for a worksheet.
Syntax
set background picture sheet Required. An expression that returns a sheet object.
picture file name Unicode text Required. The name of the graphic file.
Example
This example sets the background graphic for worksheet one.
set background picture sheet 1 picture file name ¬
"Macintosh HD:Users:Shared:watermark.gif"
Command: set default chart
Specifies the name of the chart template that Excel will use when creating new charts.
Syntax
set default chart
[format name enumeration] Optional. Specifies the name of a custom autoformat. This name
can be a string naming a custom autoformat, or it can be the special value built in chart
template to specify the built-in chart template.
[gallery enumeration] Optional. For a custom chart, specifies from which gallery to choose the chart. Can
be built in chart type (uses the Chart Gallery files) or custom chart (uses the Custom User Gallery files
saved in the Office folder or Preferences folder).
Example
This example sets the default chart template to a built-in chart format.
set default chart format name column clustered gallery built in chart type
Microsoft Excel Suite
238
Command: set FileMaker criteria
Sets the criteria for creating an Excel query table against a FileMaker database.
Syntax
set FileMaker criteria query table Required. An expression that returns a query table object.
criteria index integer Required. An index into the number of criteria that have been set.
field name Unicode text Required. The name of the field being queried.
operator enumeration Required. The operator used between field name and clause text. Can be one of the
following:
criteria equals
criteria less than or equal to
criteria greater than or equal to
criteria less than
criteria greater than
criteria begins with
criteria ends with
criteria contains
clause text Unicode text Required. The clause against which field name is tested.
condition enumeration Required. Operator used to add more criteria. Can be one of the following: no
condition, and condition, or or condition.
Example
This example performs a query against a FileMaker database, returning cases in the NorthCentral
region where sales of particular items have exceeded 5,000. It specifies two sets of criteria and that
data from three fields be presented in a new list object on the active worksheet. The example
assumes the existence of a FileMaker database named "Regions."
set QT to (make new query table with properties ¬
{connection:"FILEMAKER;HD:Desktop Folder:2000:Regions", ¬
destination:range "A1"})
set FileMaker fields of QT to ¬
{"Region", 0, "Item", 0, "Sales", 0}
set FileMaker num criteria to 2
set FileMaker criteria QT criteria index 1 field name ¬
"Region" operator criteria equals ¬
clause text "NorthCentral" condition no condition
set FileMaker criteria QT criteria index 2 field name ¬
"Sales" operator criteria greater than ¬
clause text "5000" condition and condition
set enable refresh of QT to true
set use list object of QT to true
Microsoft Excel Suite
239
Command: set list item
Sets the text entries in the specified list box or a combo box as an array of strings, or sets a single text
entry. An error occurs if there are no entries in the list.
Syntax
set list item listbox/dropdown Required. An expression that returns a listbox or dropdown
object.
[entry index integer] Optional. The index number of a single text entry to be set. If this
argument is omitted, the entire list is set as an array of strings.
rhs Unicode text Required. The new text to be set.
Remarks
Using this command clears any range specified by the list fill range property of the listbox or
dropdown object.
Example
This example sets entry four in a list box on worksheet one.
set list item listbox 1 of sheet 1 entry index 4 rhs "gadgets"
Command: set subtotals
Sets subtotals displayed with the specified field. Valid only for non-data fields.
Syntax
set subtotals pivot field Required. An expression that returns a pivot field object.
[subtotal index enumeration] Optional. Specifies the subtotal to be set. Can be one of the
following:
automatic subtotal
sum subtotal
count subtotal
average subtotal
maximum value
minimum value
product subtotal
count numbers subtotal
standard deviation
standard deviation P
variance subtotal
variance P subtotal
Subtotals are set as follows:
1 automatic 7 product
2 sum 8 count nums
3 count 9 StdDev
4 average 10 StdDevp
5 max 11 Var
6 min 12 Varp
Microsoft Excel Suite
240
value Boolean Required. Specifies the subtotal to be set as follows:
1 automatic 7 product
2 sum 8 count nums
3 count 9 StdDev
4 average 10 StdDevp
5 max 11 Var
6 min 12 Varp
Example
This example sets subtotals for pivot field 1 to automatic.
set subtotals pivot field 1 of pivot table 1 of active sheet value 1
Command: show
Displays the built-in dialog box and waits for the user to input data, or shows the scenario by
inserting its values on the worksheet. The affected cells are the changing cells of the scenario.
Syntax
show dialog/scenario Required. An expression that returns a dialog or scenario object. For
dialogs, can be one of the following:
dialog open
dialog open links
dialog save as
dialog file delete
dialog page setup
dialog print
dialog printer setup
dialog arrange all
dialog window size
dialog window move
dialog run
dialog set print titles
dialog font
dialog display
dialog protect document
dialog calculation
dialog extract
dialog data delete
dialog sort
dialog data series
dialog table
dialog format number
dialog alignment
dialog style
dialog border
dialog cell protection
dialog change link
dialog app move
dialog app size
dialog main chart type
dialog overlay chart type
dialog open mail
dialog send mail
dialog standard font
dialog consolidate
dialog sort special
dialog gallery threeD area
dialog gallery threeD column
dialog gallery threeD line
dialog gallery threeD pie
dialog view threeD
dialog goal seek
dialog workgroup
dialog fill group
dialog update link
dialog promote
dialog demote
dialog show detail
dialog object properties
dialog save new object
dialog apply style
dialog assign to object
dialog options general
dialog filter advanced
dialog mail next letter
dialog data label
dialog insert title
dialog font properties
dialog macro options
dialog workbook unhide
dialog workbook name
dialog gallery custom
dialog add chart autoformat
dialog chart add data
dialog tab order
dialog subtotal create
dialog workbook tab split
dialog workbook protect
dialog scrollbar properties
dialog pivot show pages
dialog text to columns
dialog format charttype
dialog pivot field group
dialog pivot field ungroup
dialog checkbox properties
dialog label properties
dialog listbox properties
dialog editbox properties
Microsoft Excel Suite
241
dialog column width
dialog clear
dialog paste special
dialog edit delete
dialog insert
dialog paste names
dialog define name
dialog create names
dialog formula goto
dialog formula find
dialog gallery area
dialog gallery bar
dialog gallery column
dialog gallery line
dialog gallery pie
dialog gallery scatter
dialog combination
dialog gridlines
dialog axes
dialog attach text
dialog patterns
dialog main chart
dialog overlay
dialog scale
dialog format legend
dialog format text
dialog parse
dialog unhide
dialog workspace
dialog activate
dialog copy picture
dialog delete name
dialog delete format
dialog new
dialog row height
dialog format move
dialog format size
dialog formula replace
dialog select special
dialog apply names
dialog replace font
dialog split
dialog outline
dialog save workbook
dialog copy chart
dialog format font
dialog note
dialog set update status
dialog color palette
dialog object protection
dialog show toolbar
dialog print preview
dialog edit color
dialog format main
dialog format overlay
dialog edit series
dialog define style
dialog gallery radar
dialog zoom
dialog insert object
dialog size
dialog move
dialog format auto
dialog gallery threeD bar
dialog gallery threeD surface
dialog customize toolbar
dialog workbook add
dialog workbook move
dialog workbook copy
dialog workbook options
dialog save workspace
dialog chart wizard
dialog assign to tool
dialog placement
dialog fill workgroup
dialog workbook new
dialog scenario cells
dialog scenario add
dialog scenario edit
dialog scenario summary
dialog pivot table wizard
dialog pivot field properties
dialog options calculation
dialog options edit
dialog options view
dialog add in manager
dialog menu editor
dialog attach toolbars
dialog options chart
dialog vba insert file
dialog vba procedure definition
dialog routing slip
dialog mail logon
dialog insert picture
dialog gallery doughnut
dialog chart trend
dialog workbook insert
dialog options transition
dialog open text
dialog pushbutton properties
dialog filter
dialog function wizard
dialog save copy as
dialog options lists add
dialog series axes
dialog series x
dialog series y
dialog errorbar x
dialog errorbar y
dialog format chart
dialog series order
dialog mail edit mailer
dialog standard width
dialog scenario merge
dialog summary info
dialog find file
dialog active cell font
dialog vba make add in
dialog file sharing
dialog autocorrect
dialog custom views
dialog insert name label
dialog series shape
dialog chart options data labels
dialog chart options data table
dialog set background picture
dialog data validation
dialog chart type
dialog chart location
dialog chart source data
dialog series options
dialog pivot table options
dialog pivot solve order
dialog pivot calculated field
dialog pivot calculated item
dialog conditional formatting
dialog insert hyperlink
dialog protect sharing
dialog phonetic
dialog import text file
dialog calculator
dialog web options general
dialog web options pictures
dialog web options files
dialog web options fonts
dialog web options encoding
Microsoft Excel Suite
242
Remarks
For built in dialog boxes, this command returns true if the user clicks OK, or it returns false if the
user clicks Cancel.
You can use a single dialog box to change many properties at the same time. For example, you can
use the Format Cells dialog box to change all the properties of the font object.
Example
This example displays the Open dialog box.
show (get dialog dialog open)
Command: show all data
Makes all rows of the currently filtered list visible. If AutoFilter is in use, this command changes the
arrows to "All."
Syntax
show all data sheet Required. An expression that returns a sheet object.
Example
This example makes all data on Sheet1 visible. The example should be run on a worksheet that
contains a list you filtered using the autofilter command.
show all data sheet "Sheet1"
Command: show custom view
Displays the custom view.
Syntax
show custom view custom view Required. An expression that returns a custom view object.
Example
This example displays the custom view named "My View."
show custom view custom view "My View" of active window
Command: show data form
Displays the data form associated with the worksheet.
Syntax
show data form sheet Required. An expression that returns a sheet object.
Remarks
The script pauses while you're using the data form. When you close the data form, the script
resumes at the line following the show data form command.
This command runs the custom data form, if one exists.
Microsoft Excel Suite
243
Example
This example displays the data form for Sheet1.
show data form sheet 1
Command: show levels
Displays the specified number of row and/or column levels of an outline.
Syntax
show levels outline Required. An expression that returns an outline object.
[row levels integer] Optional. Specifies the number of row levels of an outline to display. If the
outline has fewer levels than the number specified, Excel displays all the levels. If this
argument is 0 (zero) or is omitted, no action is taken on rows.
[column levels integer] Optional. Specifies the number of column levels of an outline to display. If the
outline has fewer levels than the number specified, Excel displays all the levels. If this argument is 0
(zero) or is omitted, no action is taken on columns.
Remarks
You must specify at least one argument.
Example
This example displays row levels one through three and column level one of the outline on Sheet1.
show levels outline object of sheet "Sheet1" row levels 3 column levels 1
Command: show pages
Creates a new PivotTable report for each item in the page field. Each new PivotTable report is
created on a new worksheet.
Syntax
show pages pivot table Required. An expression that returns a pivot table object.
[page field Unicode text] Optional. A string that names a single page field in the PivotTable
report.
Example
This example creates a new PivotTable report for each item in the page field, which is the field
named "Country."
set pvtTable to pivot table of range "A3" of worksheet "Sheet1"
show pages pvtTable page field "Country"
Microsoft Excel Suite
244
Command: small scroll
Scrolls the contents of the window by rows or columns.
Syntax
small scroll window/pane Required. An expression that returns a window object.
[down integer] Optional. The number of rows to scroll the contents down.
[up integer] Optional. The number of rows to scroll the contents up.
[to right integer] Optional. The number of columns to scroll the contents to the right.
[to left integer] Optional. The number of columns to scroll the contents to the left.
Remarks
If down and up are both specified, the contents of the window are scrolled by the difference of the
arguments. For example, if down is 3 and up is 6, the the contents are scrolled up three rows.
If to left and to right are both specified, the contents of the window are scrolled by the difference of
the arguments. For example, if to left is 3 and to right is 6, the contents are scrolled to the right three
columns.
Any of these arguments can be a negative number.
Example
This example scrolls the contents of the active window of Sheet1 down three rows.
small scroll active window down 3
Command: undo
Cancels the last user-interface action.
Syntax
undo
Remarks
This command undoes only the last action taken by the user before running the script or Visual
Basic macro, and it must be the first line in the script or macro.
Example
This example cancels the last user-interface action. The example must be the first line in a script.
undo
Microsoft Excel Suite
245
Command: union
Returns the union of two or more ranges.
Syntax
union
range1 range Required. One of the ranges that will be included in the union range.
range2 range Required. One of the ranges that will be included in the union range.
[range3, range4, ... range30 range] Optional. More ranges that will be included in the union range.
Example
This example fills the union of two named ranges, Range1 and Range2, with the formula =RAND()
set bigRange to (union range1 reference range of named item "Range1" ¬
range2 reference range of named item "Range2")
set formula of bigRange to "=RAND()"
Command: unprotect
Removes protection from a sheet or workbook. This command has no effect if the sheet or
workbook isn't protected.
Syntax
unprotect sheet/workbook Required. An expression that returns a workbook or sheet object.
[password Unicode text] Optional. A string that denotes the case-sensitive password to use to
unprotect the sheet or workbook. If the sheet or workbook isn't protected with a password,
this argument is ignored. If you omit this argument for a sheet that's protected with a
password, you'll be prompted for the password. If you omit this argument for a workbook
that's protected with a password, the command fails.
Remarks
If you forget the password, you cannot unprotect the sheet or workbook. It's a good idea to keep a
list of your passwords and their corresponding document names in a safe place.
Example
This example removes protection from the active workbook.
unprotect active workbook
Microsoft Excel Suite
246
Command: unprotect sharing
Turns off protection for sharing and saves the workbook.
Syntax
unprotect sharing workbook Required. An expression that returns a workbook object.
[sharing password Unicode text] Optional. The workbook password.
Example
This example turns off protection for sharing and saves the active workbook.
unprotect sharing active workbook sharing password "drowssap"
Command: update
Updates the PivotTable.
Syntax
update pivot table Required. An expression that returns a pivot table object.
Example
This example updates PivotTable one on Sheet1.
update pivot table 1 of sheet "Sheet1"
Command: update from file
Updates a read-only workbook from the saved disk version of the workbook if the disk version is
more recent than the copy of the workbook that is loaded in memory. If the disk copy hasn't
changed since the workbook was loaded, the in-memory copy of the workbook isn't reloaded.
Syntax
update from file workbook Required. An expression that returns a workbook object.
Remarks
This command is useful when a workbook is opened as read-only by user A and opened as
read/write by user B. If user B saves a newer version of the workbook to disk while user A still has
the workbook open, user A cannot get the updated copy without closing and reopening the
workbook and losing view settings. The update from file command updates the in-memory copy of
the workbook from the disk file.
Example
This example updates the active workbook from the disk version of the file.
update from file active workbook
Microsoft Excel Suite
247
Command: update link
Updates an Excel or OLE link (or links).
Syntax
update link workbook Required. An expression that returns a workbook object.
[name Unicode text] Optional. The name of the Excel or OLE link to be updated, as returned
from the link sources command.
[type enumeration] Optional. The link type. Can be link type Excel links or link type OLE links. The
default value is link type Excel links.
Example
This example updates all links in the active workbook.
update link active workbook name (link sources active workbook)
Command: use default folder suffix
This command is not currently supported.
Command: wait
Pauses a running script until a specified time. Returns true if the specified time has arrived.
Important The wait command suspends all Excel activity and may prevent you from performing
other operations on your computer while wait is in effect. However, background processes such as
printing and recalculation continue.
Syntax
wait
time to wait Unicode text Required. The time at which you want the script to resume, in Excel
date format.
Example
This example pauses a running script or Visual Basic macro until 6:23 P.M. today.
wait time to wait "18:23:00"
Command: web page preview
Displays a preview of the specified workbook as it would look if saved as a Web page.
Syntax
web page preview workbook Required. An expression that returns a workbook object.
Example
This example displays a preview of the first workbook as a Web page.
web page preview workbook 1
Drawing Suite
249
Drawing Suite
Drawing Suite Class...................................................................................................................................................249
Drawing Suite Commands........................................................................................................................................ 299
Drawing Suite Class
arc .................................................................................................................................................................................249
callout...........................................................................................................................................................................253
callout format..............................................................................................................................................................254
connector format ........................................................................................................................................................257
fill format..................................................................................................................................................................... 259
line................................................................................................................................................................................ 264
line format ...................................................................................................................................................................266
oval...............................................................................................................................................................................270
picture..........................................................................................................................................................................274
picture format .............................................................................................................................................................274
rectangle ......................................................................................................................................................................276
shadow format............................................................................................................................................................ 279
shape ............................................................................................................................................................................ 280
shape connector .......................................................................................................................................................... 285
shape line.....................................................................................................................................................................286
shape textbox ..............................................................................................................................................................286
text frame.....................................................................................................................................................................287
threeD format..............................................................................................................................................................290
word art ....................................................................................................................................................................... 293
word art format ..........................................................................................................................................................295
Class: arc
Plural
arcs
Elements
character
Represents an arc graphic.
Use arc index, where index is the arc name or the index number, to return an arc object that
represents an arc. The following example positions arc 1 fifty points to the right of the left side of the
worksheet.
set left position of arc 1 of sheet 1 to 50
Drawing Suite
250
Properties
add indent
True if text is automatically indented when the text alignment in a cell is set to equal
distribution, either horizontally or vertically. Read/write.
This property is not used in U.S./English versions of Excel.
auto scale font
True if the text in the object changes font size when the object size changes. The default value
is true. Read/write.
auto size
True if the size of the specified object is changed automatically to fit text within its boundaries.
Read/write.
border
Returns a border object that represents the border of the object. Read-only.
bottom right cell
Returns a range object that represents the cell that lies under the the lower-right corner of the
object. Read-only.
caption
Returns or sets the caption for this object. Read/write.
enabled
True if the object is enabled. Read/write.
entry index
Returns the index number of the object within the elements of the parent object. Read-only.
font object
Returns a font object that represents the font of the specified object. Read-only.
formula
Returns or sets the object's formula in A1-style notation. Read/write.
height
Returns or sets the height (in points) of the object. Read/write.
Drawing Suite
251
horizontal alignment
Returns or sets the horizontal alignment for the object. Read/write.
Can be one of the following:
horizontal align center
horizontal align center across selection
horizontal align distributed
horizontal align fill
horizontal align general
horizontal align justify
horizontal align left
horizontal align right
The horizontal align distributed alignment style works only in the Japanese version of Excel
or in an English version of Excel that you have registered as Japanese by using the Microsoft
Language Register application.
interior object
Returns an interior object that represents the interior of the axis title. Read-only.
left position
Returns or sets the position (in points) of the specified object. Read/write.
locked
True if the object is locked; false if the object can be modified when the sheet is protected.
Read/write.
locked text
True if the text in the specified object will be locked to prevent changes when the workbook is
protected. Read/write.
name
Returns or sets the name of the object. Read/write.
on action
Returns or sets either the name of a VBA macro or a string of AppleScript commands that's
run when the specified object is clicked. Strings of AppleScript commands are not saved with
the document. Read/write.
Drawing Suite
252
orientation
Returns or sets the object's orientation. Read/write.
Can be one of the following:
orientation down
orientation horizontal
orientation upward
orientation vertical
Can also be a number value between -90 and 90 degrees.
placement
Returns or sets the way the object is attached to the cells below it. Read/write.
Can be one of the following:
placement free floating
placement move
placement move and size
print object
True if the object will be printed when the document is printed. Read/write.
reading order
This property is not currently supported.
string value
Returns or sets the text of the specified object. Read/write.
top
Returns or sets the top position (in points) of the specified object. Read/write.
top left cell
Returns a range object that represents the cell that lies under the upper-left corner of the
specified object. Read-only.
Drawing Suite
253
vertical alignment
Returns or sets the vertical alignment of the object. Read/write.
Can be one of the following:
vertical alignment top
vertical alignment center
vertical alignment bottom
vertical alignment justify
vertical alignment distributed
The vertical alignment distributed alignment style works only in the Japanese version of
Excel or in an English version of Excel that you have registered as Japanese by using the
Microsoft Language Register application.
visible
True if the object is visible. Read/write.
width
Returns or sets an object's width, in points. Read/write.
wrap auto text
True if Excel wraps the text in the object. Read/write.
z order position
Returns the position of the object in the z-order, which corresponds to the object's index
number. Read-only.
Whenever you make a new shape or object, it's added to the front of the z-order by default.
Class: callout
Plural
callouts
Represents a callout shape.
Use callout index, where index is the callout name or the index number, to return a callout object.
The following example creates a new callout.
make new callout at the beginning of worksheet 1 of workbook 1
Drawing Suite
254
Properties
<Inheritance> shape
Inherits the properties and elements of the shape class.
callout format
Returns a callout format object that contains callout formatting properties. Read-only.
callout type
Returns the type of callout. Read-only.
Can be one of the following:
callout unset
callout one
callout two
callout three
callout four
Class: callout format
Plural
callout formats
Represents the formatting options for a callout.
Use the callout property to return a callout format object. The following example specifies several
attributes of callout 3 in the active worksheet:
The callout will have a vertical accent bar that separates the text from the callout line.
The angle between the callout line and the side of the callout text box will be 30 degrees.
There will be no border around the callout text.
The callout line will be attached to the top of the callout text box.
The callout line will contain two segments.
For this example to work, shape three must be a callout.
set accent of callout format of callout 3 of active sheet to true
set angle of callout format of callout 3 of active sheet to angle30
set border of callout format of callout 3 of active sheet to ¬
false
set callout format type of callout format of callout 3 of active sheet to ¬
callout three
preset drop callout 3 of active sheet drop type drop top
Drawing Suite
255
Properties
accent
True if a vertical accent bar separates the callout text from the callout line. Read/write.
angle
Returns or sets the angle of the callout line. If the callout line contains more than one line
segment, this property returns or sets the angle of the segment that is farthest from the callout
text box. Read/write.
Can be one of the following:
angle30
angle45
angle60
angle90
angle automatic
angle unset
If you set the value of this property to anything other than angle automatic, the callout line
maintains a fixed angle as you drag the callout.
auto attach
True if the place where the callout line attaches to the callout text box changes depending on
whether the origin of the callout line (where the callout points to) is to the left or right of the
callout text box. Read/write.
When the value of this property is true, the drop value (the vertical distance from the edge of
the callout text box to the place where the callout line attaches) is measured from the top of the
text box when the text box is to the right of the origin, and it's measured from the bottom of the
text box when the text box is to the left of the origin. When the value of this property is false,
the drop value is always measured from the top of the text box, regardless of the relative
positions of the text box and the origin. To set the drop value, use the custom drop command,
and use the drop property to return the drop value.
Setting this property affects a callout only if it has an explicitly set drop value, that is, if the
value of the drop type property is drop custom. By default, callouts have explicitly set drop
values when they're created.
auto length
True if the first segment of the callout line (the segment attached to the text callout box) is
scaled automatically whenever the callout is moved. False if the first segment of the callout
retains the fixed length specified by the callout format length property whenever the callout is
moved. Applies only to callouts whose lines consist of more than one segment (types callout
three and callout four). Read-only.
This property is read-only. To set this property to true, use the automatic length command. To
set this property to false, use the custom length command.
border
True if the text in the specified callout is surrounded by a border. Read/write.
Drawing Suite
256
callout format length
When the auto length property of the specified callout is set to false, the callout format length
property returns the length (in points) of the first segment of the callout line (the segment
attached to the text callout box). Applies only to callouts whose lines consist of more than one
segment (types callout three and callout four). Read-only.
This property is read-only. To set the value of this property, use the custom length command.
callout format type
Returns or sets the callout type. Read/write.
Can be one of the following:
callout unset
callout one
callout two
callout three
callout four
drop
For callouts with an explicitly set drop value, this property returns the vertical distance (in
points) from the edge of the text bounding box to the place where the callout line attaches to
the text box. This distance is measured from the top of the text box unless the auto attach
property is set to true and the text box is to the left of the origin of the callout line (the place
that the callout points to), in which case the drop distance is measured from the bottom of the
text box. Read-only.
To set the value of this property, use the custom drop command.
The value of this property accurately reflects the position of the callout line attachment to the
text box only if the callout has an explicitly set drop value, that is, if the value of the drop type
property is drop custom. To set the drop type property to drop custom, use the preset drop
command.
drop type
Returns a value that indicates where the callout line attaches to the callout text box. Read-only.
Can be one of the following:
drop bottom
drop center
drop custom
drop unset
drop top
If the callout drop type is drop custom, the values of the drop and auto attach properties and the
relative positions of the callout text box and callout line origin (the place that the callout points
to) are used to determine where the callout line attaches to the text box.
This property is read-only. To set the value of this property, use the preset drop command.
Drawing Suite
257
gap
Returns or sets the horizontal distance (in points) between the end of the callout line and the
text bounding box. Read/write.
Class: connector format
Plural
connector formats
Represents the formatting options for a shape connector. A connector is a line that attaches two
other shapes at points called connection sites. If you rearrange shapes that are connected, the
geometry of the connector will be automatically adjusted so that the shapes remain connected.
Use the connector format property to return a connector format object. Use the begin connect and
end connect commands to attach the ends of the connector to other shapes in the document. Use the
reroute connections command to automatically find the shortest path between the two shapes
connected by the connector. Use the connector property to see whether a shape is a connector.
Note that you assign a size and a position when you create a connector, but the size and position are
automatically adjusted when you attach the beginning and end of the connector to other shapes.
Therefore, if you intend to attach a connector to other shapes, the initial size and position you
specify are irrelevant. Likewise, you specify which connection sites on a shape to attach the
connector to when you attach the connector, but using the reroute connections command after the
connector is attached may change which connection sites the connector attaches to, making your
original choice of connection sites irrelevant.
The following example adds two rectangles to
myDocument and connects them with a curved
connector.
set myDocument to sheet 1
set firstRect to make new shape at end of myDocument with properties ¬
{auto shape type: autoshape rectangle, top:100, ¬
left position:50, height:200, width:100}
set secondRect to make new shape at end of myDocument with properties ¬
{auto shape type: autoshape rectangle, top:300, ¬
left position:300, height:200, width:100}
set c to make new shape connector at end of myDocument with properties ¬
{connector type:curve, top:0, left position: 0, height:0, width:0}
begin connect c connected shape firstRect connection site 1
end connect c connected shape secondRect connection site 1
reroute connections c
Drawing Suite
258
Connection sites are generally numbered according to the rules presented in the following table.
Shape type Connection site numbering scheme
AutoShapes, WordArt,
pictures, and OLE objects
The connection sites are numbered starting at the top and proceeding
counterclockwise.
Freeforms The connection sites are the vertices, and they correspond to the vertex
numbers.
To figure out which number corresponds to which connection site on a complex shape, you can
create a shape, select it, and then run the following example. The following code example numbers
each connection site and attaches a connector to it.
set myShape to shape 1 of active sheet
set offx to (left position of myShape + width of myShape + 50)
set offy to (top of myshape + height of myShape + 50)
set shapecount to count of shapes in active sheet
repeat with j from 1 to connection site count of myShape
set thisconnect to make new shape connector at end of active sheet ¬
with properties {connector type: elbow, top: offy, ¬
left position: offx, height: offy+50, width: offx+50}
end connect thisconnect connected shape myShape connection site j
set fore color of line format of thisconnect to {255, 0, 0}
set l to left position of thisconnect
set t to top of thisconnect
make new textbox at end of active sheet with properties ¬
{left position: l, top: t, width: 14, height: 36}
set thistextbox to shape textbox (shapecount + (2 * j)) of active sheet
set visible of fill format of thistextbox to false
set visible of line format of thistextbox to false
set content of characters of textbox j of active sheet to (j as string)
end repeat
Properties
begin connected
True if the beginning of the specified connector is connected to a shape. Read-only.
begin connected shape
Returns a shape object that represents the shape that the beginning of the specified connector
is attached to. Read-only.
If the beginning of the specified connector isn't attached to a shape, this property generates an
error.
Drawing Suite
259
begin connection site
Returns an integer that specifies the connection site that the beginning of a connector is
connected to. Read-only.
If the beginning of the specified connector isn't attached to a shape, this property generates an
error.
connector format type
Returns or sets the connector type. Read/write.
Can be one of the following:
connector type unset
straight
elbow, curve
end connected
True if the end of the specified connector is connected to a shape. Read-only.
end connected shape
Returns a shape object that represents the shape that the end of the specified connector is
attached to. Read-only.
If the end of the specified connector isn't attached to a shape, this property generates an error.
end connection site
Returns an integer that specifies the connection site that the end of a connector is connected to.
Read-only.
If the end of the specified connector isn't attached to a shape, this property generates an error.
Class: fill format
Plural
fill formats
Represents fill formatting for a shape. A shape can have a solid, gradient, texture, pattern, picture,
or semi-transparent fill.
Use the fill property to return a fill format object. The following example adds a rectangle to the
active worksheet and then sets the gradient and color for the rectangle's fill.
set newRect to make new shape at active sheet with properties ¬
{auto shape type:autoshape rectangle, left position:90, top:90, ¬
width:90, height:80}
set fore color of fill format of newRect to ({0, 128, 128} as RGB color)
one color gradient newRect gradient style horizontal gradient ¬
variant 1 degree 1.0
Many of the properties of the fill format object are read-only. To set one of these properties, you
must apply the corresponding command.
Drawing Suite
260
Properties
back color
Returns or sets an RGB color that represents the background color for the specified fill format.
Read/write.
fill format type
Returns the shape fill format type. Read-only.
Can be one of the following
fill unset
fill solid
fill patterned
fill gradient
fill textured
fill background
fill picture
fore color
Returns or sets an RGB color that represents the foreground color for the fill format. Read-
only.
gradient color type
Returns the gradient color type for the specified fill. Read-only.
Can be one of the following:
gradient type unset
single shade gradient type
two colors gradient type
preset colors gradient type
To set the gradient type for the fill format, use the one color gradient, preset gradient, or two
color gradient command.
Drawing Suite
261
gradient degree
Returns a value that indicates how dark or light a one-color gradient fill format is. A value of
0 (zero) means that black is mixed in with the shape's foreground color to form the gradient; a
value of 1 means that white is mixed in; and values between 0 and 1 mean that a darker or
lighter shade of the foreground color is mixed in. Read-only.
To set the gradient degree for the fill format, use the one color gradient command.
gradient style
Returns the gradient style for the specified fill. Read-only.
Can be one of the following:
gradient unset
horizontal gradient
vertical gradient
diagonal up gradient
diagonal down gradient
from corner gradient
from center gradient
from title gradient (used only in PowerPoint)
To set the gradient style for the fill, use the one color gradient or two color gradient
command.
Note Attempting to return this property for a fill that doesn't have a gradient generates an
error. To determine whether the fill has a gradient, use the fill type property.
gradient variant
Returns the gradient variant for the specified fill format as an integer value from 1 to 4 for
most gradient fills. If the gradient style is from center gradient, this property returns either 1
or 2. The values for this property correspond to the gradient variants (numbered from left to
right and from top to bottom) on the Gradient tab in the Fill Effects dialog box. Read-only.
To set the gradient variant for the fill format, use the one color gradient or two color gradient
command.
Drawing Suite
262
pattern
Returns a value that represents the pattern applied to the specified fill format. Read-only.
Can be one of the following:
five percent pattern
ten percent pattern
twenty percent pattern
twenty five percent pattern
thirty percent pattern
forty percent pattern
fifty percent pattern
sixty percent pattern
seventy percent pattern
seventy five percent pattern
eighty percent pattern
ninety percent pattern
dark downward diagonal pattern
dark horizontal pattern
dark upward diagonal pattern
dark vertical pattern
dashed downward diagonal pattern
dashed horizontal pattern
dashed upward diagonal pattern
dashed vertical pattern
diagonal brick pattern
divot pattern
dotted diamond pattern
dotted grid pattern
horizontal brick pattern
large checker board pattern
large confetti pattern
large grid pattern
light downward diagonal pattern
light horizontal pattern
light upward diagonal pattern
light vertical pattern
unset pattern
narrow horizontal pattern
narrow vertical pattern
outlined diamond pattern
pattern unset
plaid pattern
shingle pattern
small checker board pattern
small confetti pattern
small grid pattern
solid diamond pattern
sphere pattern
trellis pattern
wave pattern
weave pattern
wide downward diagonal pattern
wide upward diagonal pattern
zig zag pattern
To set the pattern for the fill format, use the patterned command.
To set the colors used in the pattern, use the back color and fore color properties.
preset gradient type
Returns the preset gradient type for the specified fill format. Read-only.
Can be one of the following:
gradient brass
gradient calm water
gradient chrome
gradient chrome2
gradient daybreak
gradient desert
gradient early sunset
gradient fire
gradient fog
gradient gold
gradient gold2
gradient horizon
gradient late sunset
gradient mahogany
gradient moss
gradient nightfall
gradient ocean
gradient parchment
gradient peacock
gradient rainbow
gradient rainbow2
gradient sapphire
gradient silver
gradient wheat
preset gradient unset
To set the preset gradient type for the fill format, use the preset gradient command.
Drawing Suite
263
preset texture
Returns the preset texture for the specified fill format. Read-only.
Can be one of the following:
preset texture unset
texture blue tissue paper
texture bouquet
texture brown marble
texture canvas
texture cork
texture denim
texture fish fossil
texture granite
texture green marble
texture medium wood
texture newsprint
texture oak
texture paper bag
texture papyrus
texture parchment
texture pink tissue paper
texture purple mesh
texture recycled paper
texture sand
texture stationery
texture walnut
texture water droplets
texture white marble
texture woven mat
To set the preset texture for the fill format, use the preset textured command.
texture name
Returns the name of the custom texture file for the specified fill format. Read-only.
To set the texture file for the fill format, use the user textured command.
texture type
Returns the texture type for the specified fill format. Read-only.
Can be one of the following:
texture type texture type unset
texture type preset texture
texture type user defined texture
To set the texture type for the fill format, use the preset textured, user picture, or user textured
command.
transparency
Returns or sets the degree of transparency of the specified fill format as a value between 0.0
(opaque) and 1.0 (clear). Read/write.
The value of this property affects the appearance of solid-colored fills and lines only; it has no
effect on the appearance of patterned lines or patterned, gradient, picture, or textured fills.
visible
True if the specified object, or the formatting applied to it, is visible. Read/write.
Drawing Suite
264
Class: line
Plural
lines
Represents a line graphic object.
Use line index, where index is the line name or the index number, to return a line object that
represents a line. The following example adds an arrowhead to a line.
set arrowhead length of line 1 of sheet 1 to arrowhead length long
set arrowhead style of line 1 of sheet 1 to arrowhead style closed
Properties
arrowhead length
Returns or sets the length of an arrowhead. Read/write.
Can be one of the following:
arrowhead length long
arrowhead length medium
arrowhead length short
arrowhead style
Returns or sets the style of an arrowhead. Read/write.
Can be one of the following:
arrowhead style closed
arrowhead style double closed
arrowhead style double open
arrowhead style none
arrowhead style open
arrowhead width
Returns or sets the width of an arrowhead. Read/write.
Can be one of the following:
arrowhead width medium
arrowhead width narrow
arrowhead width wide
Drawing Suite
265
border
Returns a border object that represents the border of the object. Read-only.
bottom right cell
Returns a range object that represents the cell that lies under the the lower-right corner of the
object. Read-only.
enabled
True if the object is enabled. Read/write.
entry index
Returns the index number of the object within the elements of the parent object. Read-only.
height
Returns or sets the height (in points) of the object. Read/write.
left position
Returns or sets the position (in points) of the specified object. Read/write.
locked
True if the object is locked; false if the object can be modified when the sheet is protected.
Read/write.
name
Returns or sets the name of the object. Read/write.
on action
Returns or sets either the name of a VBA macro or a string of AppleScript commands that's
run when the specified object is clicked. Strings of AppleScript commands are not saved with
the document. Read/write.
placement
Returns or sets the way the object is attached to the cells below it. Read/write.
Can be one of the following:
placement free floating
placement move
placement move and size
print object
True if the object will be printed when the document is printed. Read/write.
top
Returns or sets the top position (in points) of the specified object. Read/write.
top left cell
Returns a range object that represents the cell that lies under the upper-left corner of the
specified object. Read-only.
Drawing Suite
266
visible
True if the object is visible. Read/write.
width
Returns or sets an object's width, in points. Read/write.
z order position
Returns the position of the object in the z-order, which corresponds to the object's index
number. Read-only.
Whenever you make a new shape or object, it's added to the front of the z-order by default.
Class: line format
Plural
line formats
Represents line and arrowhead formatting. For a line, the line format object contains formatting
information for the line itself; for a shape with a border, this object contains formatting information
for the shape's border.
To return a line format object, use the line format property of a shape or inline shape. The following
example adds a a blue dashed line to the active document. There's a short narrow oval at the line's
starting point and a long wide triangle at its end point.
make new shape line at active sheet with properties {begin line X:100, ¬
begin line Y:100, end line X:200, end line Y:300}
set dash style of line format of shape line 1 of active sheet to ¬
line dash style dash dot dot
set fore color of line format of shape line 1 of active sheet to ¬
({50, 0, 128} as RGB color)
set begin arrowhead length of line format of shape line 1 of active sheet ¬
to short arrowhead
set begin arrowhead style of line format of shape line 1 of active sheet ¬
to oval arrowhead
set begin arrowhead width of line format of shape line 1 of active sheet ¬
to narrow width arrowhead
set end arrowhead length of line format of shape line 1 of active sheet ¬
to long arrowhead
set end arrowhead style of line format of shape line 1 of active sheet ¬
to triangle arrowhead
set end arrowhead width of line format of shape line 1 of active sheet ¬
to wide arrowhead
Drawing Suite
267
Properties
back color
Returns or sets an RGB color that represents the background color for the specified line format.
Read/write.
begin arrowhead length
Returns or sets the length of the arrowhead at the beginning of the specified line. Read/write.
Can be one of the following:
arrowhead length unset
short arrowhead
medium arrowhead
long arrowhead
begin arrowhead style
Returns or sets the style of the arrowhead at the beginning of the specified line. Read/write.
Can be one of the following:
arrowhead style unset
no arrowhead
triangle arrowhead
open_arrowhead
stealth arrowhead
diamond arrowhead
oval arrowhead
begin arrowhead width
Returns or sets the width of the arrowhead at the beginning of the specified line. Read/write.
Can be one of the following:
arrowhead width unset
narrow width arrowhead
medium width arrowhead
wide arrowhead
Drawing Suite
268
dash style
Returns or sets the dash style for the specified line. Read/write.
Can be one of the following:
line dash style unset
line dash style solid
line dash style square dot
line dash style round dot
line dash style dash
line dash style dash dot dot
line dash style long dash
line dash style dash dot
line dash style long dash dot
end arrowhead length
Returns or sets the length of the arrowhead at the end of the specified line. Read/write.
Can be one of the following:
arrowhead length unset
short arrowhead
medium arrowhead
long arrowhead
end arrowhead style
Returns or sets the style of the arrowhead at the end of the specified line. Read/write.
Can be one of the following:
arrowhead style unset
no arrowhead
triangle arrowhead
open_arrowhead
stealth arrowhead
diamond arrowhead
oval arrowhead
Drawing Suite
269
end arrowhead width
Returns or sets the width of the arrowhead at the end of the specified line. Read/write.
Can be one of the following:
arrowhead width unset
narrow width arrowhead
medium width arrowhead
wide arrowhead
fore color
Returns or sets an RGB color that represents the foreground color for the line format. Read-
only.
line style
Returns or sets the line style for the fill format object. Read/write.
Can be one of the following:
line style unset
single line
thin thin line
thin thick line
thick thin line
thick between thin line
pattern
Returns or sets a value that represents the pattern applied to the specified line format.
Read/write.
Can be one of the following:
five percent pattern
ten percent pattern
twenty percent pattern
twenty five percent pattern
thirty percent pattern
forty percent pattern
fifty percent pattern
sixty percent pattern
seventy percent pattern
seventy five percent pattern
eighty percent pattern
ninety percent pattern
dark downward diagonal pattern
dark horizontal pattern
dark upward diagonal pattern
dark vertical pattern
large checker board pattern
large confetti pattern
large grid pattern
light downward diagonal pattern
light horizontal pattern
light upward diagonal pattern
light vertical pattern
unset pattern
narrow horizontal pattern
narrow vertical pattern
outlined diamond pattern
plaid pattern
shingle pattern
small checker board pattern
small confetti pattern
small grid pattern
Drawing Suite
270
dashed downward diagonal pattern
dashed horizontal pattern
dashed upward diagonal pattern
dashed vertical pattern
diagonal brick pattern
divot pattern
dotted diamond pattern
dotted grid pattern
horizontal brick pattern
solid diamond pattern
sphere pattern
trellis pattern
wave pattern
weave pattern
wide downward diagonal pattern
wide upward diagonal pattern
zig zag pattern
transparency
Returns or sets the degree of transparency of the specified line as a value between 0.0 (opaque)
and 1.0 (clear). Read/write.
The value of this property affects the appearance of solid-colored lines only; it has no effect on
the appearance of patterned lines.
visible
True if the specified object, or the formatting applied to it, is visible. Read/write.
weight
Returns or sets the thickness (in points) of the specified line. Read/write.
Class: oval
Plural
ovals
Elements
character
Represents an oval graphic.
Use oval index, where index is the oval name or the index number, to return an oval object that
represents an oval. The following example positions oval 1 fifty points to the right of the left side of
sheet 1.
set left position of oval 1 of sheet 1 to 50
Properties
add indent
True if text is automatically indented when the text alignment in a cell is set to equal
distribution, either horizontally or vertically. Read/write.
This property is not used in U.S./English versions of Excel.
auto scale font
True if the text in the object changes font size when the object size changes. The default value
is true. Read/write.
auto size
True if the size of the specified object is changed automatically to fit text within its boundaries.
Read/write.
Drawing Suite
271
border
Returns a border object that represents the border of the object. Read-only.
bottom right cell
Returns a range object that represents the cell that lies under the the lower-right corner of the
object. Read-only.
caption
Returns or sets the caption for this object. Read/write.
enabled
True if the object is enabled. Read/write.
entry index
Returns the index number of the object within the elements of the parent object. Read-only.
font object
Returns a font object that represents the font of the specified object. Read-only.
formula
Returns or sets the object's formula in A1-style notation. Read/write.
height
Returns or sets the height (in points) of the object. Read/write.
horizontal alignment
Returns or sets the horizontal alignment for the object. Read/write.
Can be one of the following:
horizontal align center
horizontal align center across selection
horizontal align distributed
horizontal align fill
horizontal align general
horizontal align justify
horizontal align left
horizontal align right
The horizontal align distributed alignment style works only in the Japanese version of Excel
or in an English version of Excel that you have registered as Japanese by using the Microsoft
Language Register application.
interior object
Returns an interior object that represents the interior of the axis title. Read-only.
Drawing Suite
272
left position
Returns or sets the position (in points) of the specified object. Read/write.
locked
True if the object is locked; false if the object can be modified when the sheet is protected.
Read/write.
locked text
True if the text in the specified object will be locked to prevent changes when the workbook is
protected. Read/write.
name
Returns or sets the name of the object. Read/write.
on action
Returns or sets either the name of a VBA macro or a string of AppleScript commands that's
run when the specified object is clicked. Strings of AppleScript commands are not saved with
the document. Read/write.
orientation
Returns or sets the object's orientation. Read/write.
Can be one of the following:
orientation down
orientation horizontal
orientation upward
orientation vertical
Can also be a number value between -90 and 90 degrees.
placement
Returns or sets the way the object is attached to the cells below it. Read/write.
Can be one of the following:
placement free floating
placement move
placement move and size
print object
True if the object will be printed when the document is printed. Read/write.
reading order
This property is not currently supported.
Drawing Suite
273
shadow
True if the font is a shadow font or if the object has a shadow. Read/write.
string value
Returns or sets the text of the specified object. Read/write.
top
Returns or sets the top position (in points) of the specified object. Read/write.
top left cell
Returns a range object that represents the cell that lies under the upper-left corner of the
specified object. Read-only.
vertical alignment
Returns or sets the vertical alignment of the object. Read/write.
Can be one of the following:
vertical alignment top
vertical alignment center
vertical alignment bottom
vertical alignment justify
vertical alignment distributed
The vertical alignment distributed alignment style works only in the Japanese version of
Excel or in an English version of Excel that you have registered as Japanese by using the
Microsoft Language Register application.
visible
True if the object is visible. Read/write.
width
Returns or sets an object's width, in points. Read/write.
wrap auto text
True if Excel wraps the text in the object. Read/write.
z order position
Returns the position of the object in the z-order, which corresponds to the object's index
number. Read-only.
Whenever you make a new shape or object, it's added to the front of the z-order by default.
Drawing Suite
274
Class: picture
Plural
pictures
Represents a picture shape.
Use picture index, where index is the picture name or the index number, to return a picture object.
The following example creates a new picture on worksheet 1 from the file "picture.jpg."
make new picture at the beginning of worksheet 1 of workbook 1 ¬
with properties {file name:"picture.jpg."}
Properties
<Inheritance> shape
Inherits the properties and elements of the shape class.
file name
Returns or sets the URL (on the intranet or the Web) or path (local or network) to the location
where the specified source object was saved. Read/write.
The file name property generates an error if a folder in the specified path doesn’t exist.
link to file
True if the picture is linked to the file. Read-only.
picture format
Returns a picture format object that contains picture formatting properties. Read-only.
save with document
True if the picture should be saved with the document. Read-only.
Class: picture format
Plural
picture formats
Contains properties that apply to pictures.
Use the picture format property to return a picture format object. The following example sets the
brightness and contrast for picture 1 of the active worksheet and crops 18 points off the bottom of
the picture. This example works only on a picture object.
set brightness of picture format of picture 1 of active sheet to 0.3
set contrast of picture format of picture 1 of active sheet to 0.7
set crop bottom of picture format of picture 1 of active sheet to 18
Note Cropping is calculated relative to the original size of the picture. For example, if you insert a
picture that is originally 100 points high, rescale it so that it's 200 points high, and then set the crop
bottom property to 50, 100 points (not 50) will be cropped off the bottom of your picture. However,
while cropping measurements are calculated relative to the object's original scale, those
measurements reflect absolute distances from the edge of the object. You cannot set any of the
cropping properties to a negative number.
Drawing Suite
275
Properties
brightness
Returns or sets the brightness of the specified picture. The value for this property must be a
number from 0.0 (dimmest) to 1.0 (brightest). Read/write.
color type
Returns or sets the type of color transformations applied to the specified picture. Read/write.
Can be one of the following:
picture color type unset
picture color automatic
picture color gray scale
picture color black and white
picture color watermark
contrast
Returns or sets the contrast for the specified picture. The value for this property must be a
number from 0.0 (the least contrast) to 1.0 (the greatest contrast). Read/write.
crop bottom
Returns or sets the number of points that are cropped off the bottom of the specified picture.
Read/write.
crop left
Returns or sets the number of points that are cropped off the left side of the specified picture.
Read/write.
crop right
Returns or sets the number of points that are cropped off the right side of the specified picture.
Read/write.
crop top
Returns or sets the number of points that are cropped off the top of the specified picture.
Read/write.
transparency color
Returns or sets the transparent color for the specified picture as an RGB value. For this
property to take effect, the transparent background property must be set to true. Read/write.
transparent background
True if the parts of the picture that are the color defined as the transparent color appear
transparent. To set the transparent color, use the transparency color property. Read/write.
Drawing Suite
276
Class: rectangle
Plural
rectangles
Elements
character
Represents a rectangle graphic object.
Use rectangle index, where index is the rectangle name or the index number, to return a rectangle
object that represents a rectangle. The following example positions rectangle 1 fifty points to the
right of the left side of sheet 1.
set left position of rectangle 1 of sheet 1 to 50
Properties
add indent
True if text is automatically indented when the text alignment in a cell is set to equal
distribution, either horizontally or vertically. Read/write.
This property is not used in U.S./English versions of Excel.
auto scale font
True if the text in the object changes font size when the object size changes. The default value
is true. Read/write.
auto size
True if the size of the specified object is changed automatically to fit text within its boundaries.
Read/write.
border
Returns a border object that represents the border of the object. Read-only.
bottom right cell
Returns a range object that represents the cell that lies under the the lower-right corner of the
object. Read-only.
caption
Returns or sets the caption for this object. Read/write.
enabled
True if the object is enabled. Read/write.
entry index
Returns the index number of the object within the elements of the parent object. Read-only.
font object
Returns a font object that represents the font of the specified object. Read-only.
Drawing Suite
277
formula
Returns or sets the object's formula in A1-style notation. Read/write.
height
Returns or sets the height (in points) of the object. Read/write.
horizontal alignment
Returns or sets the horizontal alignment for the object. Read/write.
Can be one of the following:
horizontal align center
horizontal align center across selection
horizontal align distributed
horizontal align fill
horizontal align general
horizontal align justify
horizontal align left
horizontal align right
The horizontal align distributed alignment style works only in the Japanese version of Excel
or in an English version of Excel that you have registered as Japanese by using the Microsoft
Language Register application.
interior object
Returns an interior object that represents the interior of the axis title. Read-only.
left position
Returns or sets the position (in points) of the specified object. Read/write.
locked
True if the object is locked; false if the object can be modified when the sheet is protected.
Read/write.
locked text
True if the text in the specified object will be locked to prevent changes when the workbook is
protected. Read/write.
name
Returns or sets the name of the object. Read/write.
on action
Returns or sets either the name of a VBA macro or a string of AppleScript commands that's
run when the specified object is clicked. Strings of AppleScript commands are not saved with
the document. Read/write.
Drawing Suite
278
orientation
Returns or sets the object's orientation. Read/write.
Can be one of the following:
orientation down
orientation horizontal
orientation upward
orientation vertical
Can also be a number value between -90 and 90 degrees.
placement
Returns or sets the way the object is attached to the cells below it. Read/write.
Can be one of the following:
placement free floating
placement move
placement move and size
print object
True if the object will be printed when the document is printed. Read/write.
reading order
Returns or sets the reading order for the axis title. Read/write.
This property is not currently supported.
rounded corners
True if the embedded chart has rounded corners. Read/write.
shadow
True if the font is a shadow font or if the object has a shadow. Read/write.
string value
Returns or sets the text of the specified object. Read/write.
top
Returns or sets the top position (in points) of the specified object. Read/write.
top left cell
Returns a range object that represents the cell that lies under the upper-left corner of the
specified object. Read-only.
Drawing Suite
279
vertical alignment
Returns or sets the vertical alignment of the object. Read/write.
Can be one of the following:
vertical alignment top
vertical alignment center
vertical alignment bottom
vertical alignment justify
vertical alignment distributed
The vertical alignment distributed alignment style works only in the Japanese version of
Excel or in an English version of Excel that you have registered as Japanese by using the
Microsoft Language Register application.
visible
True if the object is visible. Read/write.
width
Returns or sets an object's width, in points. Read/write.
wrap auto text
True if Excel wraps the text in the object. Read/write.
z order position
Returns the position of the object in the z-order, which corresponds to the object's index
number. Read-only.
Whenever you make a new shape or object, it's added to the front of the z-order by default.
Class: shadow format
Plural
shadow formats
Represents shadow formatting for a shape.
Use the shadow property to return a shadow format object. The following example adds a shadowed
rectangle to the active worksheet. The semitransparent blue shadow is offset 5 points to the right of
the rectangle and 3 points above it.
set newShape to make new shape at active sheet with properties ¬
{auto shape type:autoshape rectangle, left position:50, top:50, ¬
width:100, height:200}
set fore color of shadow of newShape to ({0, 0, 128} as RGB color)
set offset x of shadow of newShape to 5
set offset y of shadow of newShape to -3
set transparency of shadow of newShape to 0.5
set visible of shadow of newShape to true
Drawing Suite
280
Properties
fore color
Returns or sets an RGB color that represents the foreground color for the line format. Read-
only.
obscured
True if the shadow of the specified shape appears filled in and is obscured by the shape, even
if the shape has no fill. False if the shadow has no fill and the outline of the shadow is visible
through the shape if the shape has no fill. Read/write.
offset x
Returns or sets the horizontal offset (in points) of the shadow from the specified shape. A
positive value offsets the shadow to the right of the shape; a negative value offsets it to the left.
Read/write.
offset y
Returns or sets the vertical offset (in points) of the shadow from the specified shape. A positive
value offsets the shadow below the shape; a negative value offsets it above the shape.
Read/write.
shadow format type
Returns or sets the shape shadow type. Read/write.
Can be one of the following:
shadow unset
shadow1
shadow2
shadow3
shadow4
shadow5
shadow6
shadow7
shadow8
shadow9
shadow10
shadow11
shadow12
shadow13
shadow14
shadow15
shadow16
shadow17
shadow18
shadow19
shadow20
transparency
Returns or sets the degree of transparency of the specified shadow as a value between 0.0
(opaque) and 1.0 (clear). Read/write.
visible
True if the shadow format object, or the formatting applied to it, is visible. Read/write.
Class: shape
Plural
shapes
Represents a single shape on a worksheet, such as an AutoShape, freeform, OLE object, or picture.
Use shape index, where index is the shape name or the index number, to return a shape object. The
following example horizontally flips shape 1 and the shape named "Rectangle 1" on
myDocument.
Drawing Suite
281
set myDocument to sheet 1
flip shape 1 of myDocument flip cmd flip horizontal
flip shape named "Rectangle 1" of myDocument flip cmd flip horizontal
Each shape is assigned a default name when you add it to the shapes list. To give the shape a more
meaningful name, use the name property. The following example adds a rectangle to
myDocument,
gives it the name "Red Square," and then sets its foreground color and line style.
set myDocument to sheet 1
set myRect to make new shape at end of myDocument ¬
with properties {auto shape type: autoshape rectangle, ¬
top: 144, left position: 144, height:72, width: 72}
set name of myRect to "Red Square"
set fore color of fill format of myRect to (255, 0, 0)
set dash style of line format of myRect to line dash style dash dot
To return a shape object that represents one of the shapes attached by a connector, use the begin
connected shape or end connected shape property.
Properties
auto shape type
Returns or sets the type of AutoShape. Read/write.
Can be one of the following:
autoshape shape type unset
autoshape rectangle
autoshape trapezoid
autoshape rounded rectangle
autoshape isosceles triangle
autoshape oval
autoshape cross
autoshape can
autoshape bevel
autoshape smiley face
autoshape no symbol
autoshape heart
autoshape sun
autoshape arc
autoshape double brace
autoshape left bracket
autoshape left brace
autoshape right arrow
autoshape up arrow
autoshape left right arrow
autoshape quad arrow
autoshape bent arrow
autoshape left up arrow
autoshape curved right arrow
autoshape curved up arrow
autoshape striped right arrow
autoshape pentagon
autoshape balloon
autoshape parallelogram
autoshape diamond
autoshape octagon
autoshape right triangle
autoshape hexagon
autoshape regular pentagon
autoshape cube
autoshape folded corner
autoshape donut
autoshape block arc
autoshape lightning bolt
autoshape moon
autoshape double bracket
autoshape plaque
autoshape right bracket
autoshape right brace
autoshape left arrow
autoshape down arrow
autoshape up down arrow
autoshape left right up arrow
autoshape U turn arrow
autoshape dent up arrow
autoshape curved left arrow
autoshape curved down arrow
autoshape notched right arrow
autoshape chevron
Drawing Suite
282
autoshape right arrow callout
autoshape up arrow callout
autoshape left right arrow callout
autoshape quad arrow callout
autoshape flowchart process
autoshape flowchart decision
autoshape flowchart predefined process
autoshape flowchart document
autoshape flowchart terminator
autoshape flowchart manual input
autoshape flowchart connector
autoshape flowchart card
autoshape flowchart summing junction
autoshape flowchart collate
autoshape flowchart extract
autoshape flowchart stored data
autoshape flowchart sequential access storage
autoshape flowchart direct access storage
autoshape explosion one
autoshape four point star
autoshape eight point star
autoshape twenty four point star
autoshape up ribbon
autoshape curved up ribbon
autoshape vertical scroll
autoshape wave
autoshape rectangular callout
autoshape oval callout
autoshape line callout one
autoshape line callout three
autoshape line callout one accent bar
autoshape line callout three accent bar
autoshape line callout one no border
autoshape line callout three no border
autoshape callout one border and accent bar
autoshape callout three border and accent bar
autoshape action button custom
autoshape action button help
autoshape action button back or previous
autoshape action button beginning
autoshape action button return
autoshape action button sound
autoshape left arrow callout
autoshape down arrow callout
autoshape up down arrow callout
autoshape circular arrow
autoshape flowchart alternate process
autoshape flowchart data
autoshape flowchart internal storage
autoshape flowchart multi document
autoshape flowchart preparation
autoshape flowchart manual operation
autoshape flowchart offpage connector
autoshape flowchart punched tape
autoshape flowchart or
autoshape flowchart sort
autoshape flowchart merge
autoshape flowchart delay
autoshape flowchart magnetic disk
autoshape flowchart display
autoshape explosion two
autoshape five point star
autoshape sixteen point star
autoshape thirty two point star
autoshape down ribbon
autoshape curved down ribbon
autoshape horizontal scroll
autoshape double wave
autoshape rounded rectangular callout
autoshape cloud callout
autoshape line callout two
autoshape line callout four
autoshape line callout two accent bar
autoshape line callout four accent bar
autoshape line callout two no border
autoshape line callout four no border
autoshape callout two border and accent bar
autoshape callout four border and accent bar
autoshape action button home
autoshape action button information
autoshape action button forward or next
autoshape action button end
autoshape action button document
autoshape action button movie
black white mode
This property is not used in Excel. It is provided only for compatibility with the drawing object
models in other Microsoft Office applications.
bottom right cell
Returns a range object that represents the cell that lies under the the lower-right corner of the
object. Read-only.
Drawing Suite
283
connection site count
Returns the number of connection sites on the specified shape. Read-only.
connector
True if the specified shape is a connector. Read-only.
connector format
Returns a connector format object that contains connector formatting properties. Applies to
shape objects that represent connectors. Read-only.
connector type
Returns the type of the connector. Read-only.
Can be one of the following:
connector type unset
straight
elbow
curve
fill format
Returns a fill format object that contains fill formatting properties for the specified shape.
Read-only.
height
Returns or sets the height of the specified shape. Read/write.
horizontal flip
True if the specified shape is flipped around the horizontal axis. Read-only.
hyperlink
Returns a hyperlink object that represents the hyperlink associated with the specified shape
object. Read-only.
Note If there's no hyperlink associated with the specified shape, an error occurs.
left position
Returns or sets the horizontal position (in points) of the specified shape or shape range.
Read/write.
line format
Returns a line format object that contains line formatting properties for the specified shape.
(For a line, the line format object represents the line itself; for a shape with a border, the line
format object represents the border.) Read-only.
lock aspect ratio
True if the specified shape retains its original proportions when you resize it. False if you can
change the height and width of the shape independently of one another when you resize it.
Read/write.
Drawing Suite
284
locked
True if the object is locked; false if the object can be modified when the sheet is protected.
Read/write.
name
Returns or sets the shape name. Read/write.
placement
Returns or sets the way the object is attached to the cells below it. Read/write.
Can be one of the following:
placement free floating
placement move
placement move and size
rotation
Returns or sets the number of degrees the specified shape is rotated around the z-axis. A
positive value indicates clockwise rotation; a negative value indicates counterclockwise
rotation. Read/write.
To set the rotation of a three-dimensional shape around the x-axis or the y-axis, use the rotation
x property or the rotation y property of the threeD format object.
shadow
Returns a shadow format object that represents the shadow formatting for the specified shape.
Read-only.
shape on action
Returns or sets either the name of a VBA macro or a string of AppleScript commands that's
run when the specified object is clicked. Strings of AppleScript commands are not saved with
the document. Read/write.
shape type
Returns the shape type. Read-only.
Can be one of the following:
shape type auto
shape type callout
shape type chart
shape type comment
shape type embedded OLE object
shape type form control
shape type free form
shape type group
shape type line
shape type linked OLE object
shape type linked picture
shape type media
shape type embedded OLE control
shape type picture
shape type placeholder
shape type unset
shape type text box
shape type text effect
Drawing Suite
285
text frame
Returns a text frame object that contains the text for the specified shape. Read-only.
threeD format
Returns a threeD format object that contains 3-D-effect formatting properties for the specified
shape. Read-only.
top
Returns or sets the vertical position (in points) of the specified shape or shape range.
Read/write.
top left cell
Returns a range object that represents the cell that lies under the upper-left corner of the
specified object. Read-only.
vertical flip
True if the specified shape is flipped around the vertical axis. Read-only.
visible
True if the specified object, or the formatting applied to it, is visible. Read/write.
width
Returns or sets the width (in points) of the specified object. Read/write.
z order position
Returns the position of the object in the z-order, which corresponds to the object's index
number. Read-only.
Whenever you make a new shape or object, it's added to the front of the z-order by default.
Class: shape connector
Plural
shape connectors
Represents a shape connector.
Use shape connectors index, where index is the shape connector name or the index number, to return
a shape connector object. The following example creates a new elbow shape connector.
make new shape connector at the beginning of worksheet 1 of workbook 1 ¬
with properties {left position:100, width:100, top:100, height:100, ¬
connector type:elbow}
Properties
<Inheritance> shape
Inherits the properties and elements of the shape class.
connector format
Returns a connector format object that contains connector formatting properties. Read-only.
Drawing Suite
286
connector type
Returns the type of the connector. Read-only.
Can be one of the following:
connector type unset
straight
elbow
curve
Class: shape line
Plural
shape lines
Represents a shape line.
Use shape line index, where index is the shape line name or the index number, to return a shape line
object. The following example creates a new shape line.
make new shape line at the beginning of worksheet 1 of workbook 1 ¬
with properties {left position:100, width:100, top:100, height:100}
Properties
<Inheritance> shape
Inherits the properties and elements of the shape class.
begin line X
Returns or sets the beginning X position of the line. Read/write.
begin line Y
Returns or sets the beginning Y position of the line. Read/write.
end line X
Returns or sets the ending X position of the line. Read/write.
end line Y
Returns or sets the ending Y position of the line. Read/write.
Class: shape textbox
Plural
shape textboxes
Represents a shape textbox.
Use shape textbox index, where index is the shape textbox name or the index number, to return a
shape textbox object. The following example creates a new shape textbox.
Drawing Suite
287
make new shape textbox at the beginning of worksheet 1 of workbook 1 ¬
with properties {left position:100.0, top:100.0}
set content of characters of textbox 1 of worksheet 1 of workbook 1 ¬
to "shape textbox content"
Properties
<Inheritance> shape
Inherits the properties and elements of the shape class.
text orientation
Returns the text orientation of the object. Read-only.
Can be one of the following:
text orientation unset
horizontal
upward
downward
vertical east asian
vertical
horizontal rotated east asian
Class: text frame
Plural
text frames
Represents the text frame in a shape object. Contains the text in the text frame as well as the
properties that control the margins and orientation of the text frame.
Use the text frame property to return the text frame object for a shape. The following example adds a
rectangle to
myDocument and then sets the margins for the text frame.
set myDocument to sheet 1
set myShape to make new shape at end of myDocument ¬
with properties {auto shape type: autoshape rectangle, ¬
top:0, left position: 0, height: 250, width: 140}
set margin bottom of text frame of myShape to 10
set margin left of text frame of myShape to 10
set margin right of text frame of myShape to 10
set margin top of text frame of myShape to 10
Note Currently, you cannot set the content of characters of a text frame. Also, some shapes don't
support attached text (lines, freeforms, pictures, and OLE objects, for example). If you attempt to
return or set properties that control text in a text frame for those objects, an error occurs.
Drawing Suite
288
Properties
auto margins
True if Excel automatically calculates text frame margins. Read/write.
When this property is true, the margin left, margin right, margin top, and margin bottom
properties are ignored.
auto size
True if the size of the specified object is changed automatically to fit text within its boundaries.
Read/write.
horizontal alignment
Returns or sets the horizontal alignment for the object. Read/write.
Can be one of the following:
horizontal align center
horizontal align center across selection
horizontal align distributed
horizontal align fill
horizontal align general
horizontal align justify
horizontal align left
horizontal align right
The horizontal align distributed alignment style works only in the Japanese version of Excel
or in an English version of Excel that you have registered as Japanese by using the Microsoft
Language Register application.
margin bottom
Returns or sets the distance (in points) between the bottom of the text frame and the bottom of
the inscribed rectangle of the shape that contains the text. Read/write.
This property is ignored when the auto margins property is set to true.
margin left
Returns or sets the distance (in points) between the left edge of the text frame and the left edge
of the inscribed rectangle of the shape that contains the text. Read/write.
This property is ignored when the auto margins property is set to true.
margin right
Returns or sets the distance (in points) between the right edge of the text frame and the right
edge of the inscribed rectangle of the shape that contains the text. Read/write.
This property is ignored when the auto margins property is set to true.
Drawing Suite
289
margin top
Returns or sets the distance (in points) between the top of the text frame and the top of the
inscribed rectangle of the shape that contains the text. Read/write.
This property is ignored when the auto margins property is set to true.
orientation
Returns or sets the orientation of the text inside the frame. Read/write.
Can be one of the following:
downward
horizontal
text orientation unset
upward
vertical east asian
vertical
horizontal rotated east asian
reading order
This property is not currently supported.
vertical alignment
Returns or sets the vertical alignment of the object. Read/write.
Can be any of the following:
valign top
valign center
valign bottom
valign justify
valign distributed
The valign distributed alignment style works only in the Japanese version of Excel or in an
English version of Excel that you have registered as Japanese by using the Microsoft Language
Register application.
wrap auto text
True if Excel wraps the text in the object. Read/write.
Drawing Suite
290
Class: threeD format
Plural
threeD formats
Represents a shape's three-dimensional formatting.
Use the threeD format property to return a threeD format object. The following example adds an
oval to the active document and then specifies that the oval be extruded to a depth of 50 points and
that the extrusion be purple.
set myShape to make new shape at active sheet with properties ¬
{auto shape type:autoshape oval, left position:90, top:90, ¬
width:90, height:90}
set visible of threeD format of myShape to true
set depth of threeD format of myShape to 50
set extrusion color of threeD format of myShape ¬
to ({255, 100, 255} as RGB color)
You cannot apply three-dimensional formatting to some kinds of shapes, such as beveled shapes or
multiple-disjoint paths. Most of the properties and commands of the threeD format object for such a
shape will fail.
Properties
depth
Returns or sets the depth of the shape's extrusion. Can be a value from -600 through 9600
(positive values produce an extrusion whose front face is the original shape; negative values
produce an extrusion whose back face is the original shape). Read/write.
extrusion color
Returns or sets an RGB color that represents the color of the shape's extrusion. Read/write.
extrusion color type
Returns or sets a value that indicates what will determine the extrusion color. Read/write.
Can be one of the following:
extrusion color type unset
automatic
custom
perspective
True if the extrusion appears in perspective — that is, if the walls of the extrusion narrow
toward a vanishing point. False if the extrusion is a parallel, or orthographic, projection — that
is, if the walls don't narrow toward a vanishing point. Read/write.
Drawing Suite
291
preset extrusion direction
Returns the direction that the extrusion's sweep path takes away from the extruded shape (the
front face of the extrusion). Read-only.
Can be one of the following:
extrude bottom
extrude bottom left
extrude bottom right
extrude left
extrude none
extrude right
extrude top
extrude top left
extrude top right
preset extrusion direction unset
To set the value of this property, use the set extrusion direction command.
preset lighting direction
Returns or sets the position of the light source relative to the extrusion. Read/write.
Can be one of the following:
light from bottom
light from bottom left
light from bottom right
light from left
light from none
light from right
light from top
light from top left
light from top right
preset lighting direction unset
Note You won't see the lighting effects you set if the extrusion has a wireframe surface.
Drawing Suite
292
preset lighting softness
Returns or sets the intensity of the extrusion lighting. Read/write.
Can be one of the following:
lighting bright
lighting dim
lighting normal
lighting softness unset
preset material
Returns or sets the extrusion surface material. Read/write.
Can be one of the following:
matte
metal
plastic
wireframe
preset material unset
preset threeD format
Returns the preset extrusion format. Each preset extrusion format contains a set of preset
values for the various properties of the extrusion. If the extrusion has a custom format rather
than a preset format, this property returns preset threeD format unset. Read-only.
Can be one of the following:
preset threeD format unset
format1
format2
format3
format4
format5
format6
format7
format8
format9
format10
format11
format12
format13
format14
format15
format16
format17
format18
format19
format20
The values for this property correspond to the options (numbered from left to right, top to
bottom) displayed when you click the 3-D button on the Drawing toolbar.
To set the preset extrusion format, use the set threeD format command.
Drawing Suite
293
rotation x
Returns or sets the rotation of the extruded shape around the x-axis, in degrees. Can be a value
from -90 through 90. A positive value indicates upward rotation; a negative value indicates
downward rotation. Read/write.
To set the rotation of the extruded shape around the y-axis, use the rotation y property. To set
the rotation of the extruded shape around the z-axis, use the rotation property of the shape
object. To change the direction of the extrusion's sweep path without rotating the front face of
the extrusion, use the set extrusion direction command.
rotation y
Returns or sets the rotation (in degrees) of the extruded shape around the y-axis. Can be a
value from -90 through 90. A positive value indicates rotation to the left; a negative value
indicates rotation to the right. Read/write.
To set the rotation of the extruded shape around the x-axis, use the rotation x property. To set
the rotation of the extruded shape around the z-axis, use the rotation property of the shape
object. To change the direction of the extrusion's sweep path without rotating the front face of
the extrusion, use the set extrusion direction command.
visible
True if the specified object, or the formatting applied to it, is visible. Read/write.
Class: word art
Plural
word arts
Represents a word art object.
Use word art index, where index is the name or the index number, to return a single word art object.
This example adds WordArt that contains the text "Test text" at the beginning of the active
document.
make new word art at beginning of active sheet of active workbook ¬
with properties {word art text:"Test text", ¬
left position:(inches to points inches 1), ¬
top:(inches to points inches 1)}
set preset word art effect of word art format of word art 1 ¬
of active sheet of active workbook to text effect11
set font name of word art format of word art 1 of active sheet ¬
of active workbook to "Arial Black"
Drawing Suite
294
Properties
<Inheritance> shape
Inherits the properties and elements of the shape class.
bold
True to set the font used in the WordArt to bold. Read-only.
font name
The name of the font used in the WordArt. Read-only.
font size
The size (in points) of the font used in the WordArt. Read-only.
italic
True to set the font used in the WordArt to italic. Read-only.
preset word art effect
Returns the style of the specified WordArt. The values for this property correspond to the
formats in the WordArt Gallery dialog box (numbered from left to right, top to bottom).
Read-only.
Can be one of the following.:
text effect unset
text effect1
text effect2
text effect3
text effect4
text effect5
text effect6
text effect7
text effect8
text effect9
text effect10
text effect11
text effect12
text effect13
text effect14
text effect15
text effect16
text effect17
text effect18
text effect19
text effect20
text effect21
text effect22
text effect23
text effect24
text effect25
text effect26
text effect27
text effect28
text effect29
text effect30
word art format
Returns the word art format object associated with the WordArt shape object. Read-only.
word art text
The text in the WordArt. Read-only
Drawing Suite
295
Class: word art format
Plural
word art formats
Represents formatting options for WordArt objects.
Use the word art format property to return a word art format object. The following example sets the
font name and formatting for word art 1 on the active document.
set font name of word art format of word art 1 of active sheet ¬
of active workbook to "Courier New"
set bold of word art format of word art 1 of active sheet ¬
of active workbook to true
set italic of word art format of word art 1 of active sheet ¬
of active workbook to true
Properties
alignment
Returns or sets the alignment for the specified text effect. Read/write.
Can be one of the following:
text effect alignment unset
left text effect alignment
centered text effect alignment
right text effect alignment
justify text effect alignment
word justify text effect alignment
stretch justify text effect alignment
bold
True if the text of the WordArt shape is formatted as bold. Read/write.
font name
Returns or sets the name of the font used by the WordArt shape. Read/write.
Drawing Suite
296
font size
Returns or sets the font size (in points) for the specified WordArt. Read/write.
italic
True if the text of the WordArt shape is formatted as italic. Read/write.
kerned pairs
True if character pairs in the specified WordArt are kerned. Read/write.
normalized height
True if all characters (both uppercase and lowercase) in the specified WordArt are the same
height. Read/write.
preset shape
Returns or sets the shape of the specified WordArt. Read/write.
Can be one of the following:
arch down curve
arch down pour
arch up curve
arch up pour
button curve
button pour
can down
can up
cascade down
cascade up
chevron down
chevron up
circle curve
circle pour
curve down
curve up
deflate
deflate bottom
deflate inflate
deflate inflate deflate
deflate top
double wave1
double wave2
fade down
fade left
fade right
fade up
inflate
inflate bottom
inflate top
text effect unset
plain text
ring inside
ring outside
slant down
slant up
stop
triangle down
triangle up
wave1
wave2
Setting the preset word art effect property automatically sets the preset shape property.
Drawing Suite
297
preset word art effect
Returns or sets the style of the specified WordArt. The values for this property correspond to
the formats in the WordArt Gallery dialog box (numbered from left to right, top to bottom).
Read/write.
Can be one of the following:
text effect unset
text effect1
text effect2
text effect3
text effect4
text effect5
text effect6
text effect7
text effect8
text effect9
text effect10
text effect11
text effect12
text effect13
text effect14
text effect15
text effect16
text effect17
text effect18
text effect19
text effect20
text effect21
text effect22
text effect23
text effect24
text effect25
text effect26
text effect27
text effect28
text effect29
text effect30
Setting the preset word art effect property automatically sets many other formatting properties
of the specified shape.
rotated chars
True if characters in the specified WordArt are rotated 90 degrees relative to the WordArt's
bounding shape. False if characters in the specified WordArt retain their original orientation
relative to the bounding shape. Read/write.
If the WordArt has horizontal text, setting the rotated chars property to true rotates the
characters 90 degrees counterclockwise. If the WordArt has vertical text, setting the rotated
chars property to false rotates the characters 90 degrees clockwise. To switch between
horizontal and vertical text flow, use the toggle vertical text command.
The flip command and rotation property of the shape object and the rotated chars property and
toggle vertical text command all affect the character orientation and direction of text flow in a
word art object. You may have to experiment to find out how to combine the effects of these
properties and commands to get the result you want.
Drawing Suite
298
tracking
Returns or sets the ratio of the horizontal space allotted to each character in the specified
WordArt to the width of the character. Can be a value from 0 (zero) through 5. (Large values
for this property specify ample space between characters; values less than 1 can produce
character overlap.) Read/write.
The following table gives the values of the tracking property that correspond to the settings
available in the user interface.
User interface setting Equivalent tracking property value
Very Tight 0.8
Tight 0.9
Normal 1.0
Loose 1.2
Very Loose 1.5
word art text
Returns or sets the text associated with the WordArt. Read/write.
.
Drawing Suite
299
Drawing Suite Commands
apply ............................................................................................................................................................................299
automatic length......................................................................................................................................................... 300
begin connect ..............................................................................................................................................................300
begin disconnect......................................................................................................................................................... 301
bring to front (drawing)............................................................................................................................................. 301
check spelling (drawing) ...........................................................................................................................................302
copy object (drawing) ................................................................................................................................................ 302
copy picture (drawing) ..............................................................................................................................................303
custom drop ................................................................................................................................................................303
custom length..............................................................................................................................................................304
cut (drawing) ..............................................................................................................................................................304
end connect .................................................................................................................................................................305
end disconnect............................................................................................................................................................ 306
flip ................................................................................................................................................................................ 306
one color gradient....................................................................................................................................................... 306
patterned .....................................................................................................................................................................307
pick up ......................................................................................................................................................................... 308
preset drop ..................................................................................................................................................................308
preset gradient............................................................................................................................................................309
preset textured ............................................................................................................................................................310
reroute connections ....................................................................................................................................................310
reset rotation ...............................................................................................................................................................311
scale height..................................................................................................................................................................312
scale width...................................................................................................................................................................313
send to back (drawing) ..............................................................................................................................................313
set extrusion direction................................................................................................................................................314
set shapes default properties ....................................................................................................................................315
set threed format ........................................................................................................................................................ 315
solid..............................................................................................................................................................................316
toggle vertical text ......................................................................................................................................................316
two color gradient ...................................................................................................................................................... 317
user picture..................................................................................................................................................................318
user textured ............................................................................................................................................................... 318
z order.......................................................................................................................................................................... 318
Command: apply
Applies to the specified shape formatting that's been copied by using the pick up command.
Syntax
apply shape Required. An expression that returns a shape object.
Example
This example copies the formatting of shape 1 on
myDocument and then applies the copied
formatting to shape 2.
set myDocument to worksheet 1
pick up shape 1 of myDocument
apply shape 2 of myDocument
Drawing Suite
300
Command: automatic length
Specifies that the first segment of the callout line (the segment attached to the text callout box) be
scaled automatically when the callout is moved. To specify that the first segment of the callout line
retain the fixed length returned by the callout format length property of the callout format object
whenever the callout is moved, use the custom length command. Applies only to callouts whose
lines consist of more than one segment (types callout three and callout four).
Syntax
automatic length callout format Required. An expression that returns a callout format object.
Remarks
Applying this command sets the auto length property of the callout format object to true.
Example
This example toggles between an automatically scaling first segment and one with a fixed length for
the callout line for the first shape on myDocument. For the example to work, the first shape must be a
callout.
set myDocument to worksheet 1
if auto length of callout format of callout 1 of myDocument is true then
custom length callout format of callout 1 of myDocument length 50
else
automatic length callout format of callout 1 of myDocument
end if
Command: begin connect
Attaches the beginning of the specified connector to a specified shape. If there's already a
connection between the beginning of the connector and another shape, that connection is broken. If
the beginning of the connector isn't already positioned at the specified connecting site, this
command moves the beginning of the connector to the connecting site and adjusts the size and
position of the connector. Use the end connect command to attach the end of the connector to a
shape.
Syntax
begin connect connector format Required. An expression that returns a connector format object.
connected shape shape Required. The shape to attach the beginning of the connector to.
connection site integer Required. A connection site on the shape specified by connected shape. Must be an
integer between 1 and the integer returned by the connection site count property of the specified shape. If
you want the connector to automatically find the shortest path between the two shapes it connects,
specify any valid integer for this argument and then use the reroute connections command after the
connector is attached to shapes at both ends.
Drawing Suite
301
Remarks
When you attach a connector to an object, the size and position of the connector are automatically
adjusted, if necessary.
Example
This example adds two rectangles to
myDocument and connects them with a curved connector.
Notice that the reroute connections command makes it irrelevant what values you supply for the
connection site arguments used with the begin connect and end connect commands.
set myDocument to worksheet 1
set firstRect to make new shape at end of myDocument ¬
with properties {auto shape type:autoshape rectangle, ¬
left position:100, top:50, width:200, height:100}
set secondRect to make new shape at end of myDocument ¬
with properties {auto shape type:autoshape rectangle, ¬
left position:300, top:300, width:200, height:100}
set c to make new shape connector at end of myDocument ¬
with properties {left position:0, top:0, width:100, ¬
height:100}
set connector format type of connector format of c to curve
begin connect connector format of c connected shape firstRect ¬
connection site 1
end connect connector format of c connected shape secondRect ¬
connection site 1
reroute connections c
Command: begin disconnect
This command is not currently supported.
Command: bring to front (drawing)
Brings the line, rectangle, oval, or arc object to the front of the z-order.
Syntax
bring to front line/rectangle/oval/arc Required. An expression that returns a line, rectangle,
oval, or arc object.
Example
This example brings rectangle one on Sheet1 to the front of the z-order.
bring to front rectangle 1 of worksheet 1
Drawing Suite
302
Command: check spelling (drawing)
Checks the spelling of an object. This form has no return value; Excel displays the Spelling dialog
box.
Syntax
check spelling rectangle/oval/arc Required. An expression that returns a rectangle, oval, or arc
object.
[custom dictionary Unicode text] Optional. A string that indicates the file name of the custom
dictionary to examine if the word isn't found in the main dictionary. If this argument is
omitted, the currently specified dictionary is used.
[ignore uppercase Boolean] Optional. True to have Excel ignore words that are all uppercase. False to have
Excel check words that are all uppercase. If this argument is omitted, the current setting will be used.
[always suggest Boolean] Optional. True to have Excel display a list of suggested alternate spellings when
an incorrect spelling is found. False to have Excel wait for you to input the correct spelling. If this
argument is omitted, the current setting will be used.
Example
This example checks the spelling of text in Rectangle 1 on Sheet1.
check spelling rectangle 1 of worksheet "Sheet1"
Command: copy object (drawing)
Copies the object to the Clipboard.
Syntax
copy object line/rectangle/oval/arc/shape Required. An expression that returns one of the listed
objects.
Example
This example copies a rectangle on Sheet1 and then pastes it to a new worksheet.
copy object rectangle 1 of worksheet 1
set newSheet to make new worksheet at end of active workbook
paste newSheet
Drawing Suite
303
Command: copy picture (drawing)
Copies the line, rectangle, oval, arc, or shape object to the Clipboard as a picture.
Syntax
copy picture line/rectangle/oval/arc/shape Required. An expression that returns one of the
listed objects.
[appearance enumeration] Optional. Specifies how the picture should be copied. Can be one of
the following: screen or printer. If screen is used, the picture is copied to resemble its display
on the screen as closely as possible. If printer is used, the picture is copied as it will look when
it's printed. The default value is screen.
[format enumeration] Optional. The format of the picture. Can be one of the following: picture or bitmap.
The default value is picture.
Example
This example copies a screen image of cells A1:D4 on Sheet1 to the Clipboard, and then it pastes the
bitmap to another location on Sheet1.
set thisRange to range "A1:D4" of sheet 1
copy picture thisRange appearance screen format bitmap
paste worksheet sheet 1 destination range "A7"
Command: custom drop
Sets the vertical distance (in points) from the edge of the text bounding box to the place where the
callout line attaches to the text box. This distance is measured from the top of the text box unless the
auto attach property of the callout format object is set to true and the text box is to the left of the
origin of the callout line (the place that the callout points to), in which case the drop distance is
measured from the bottom of the text box.
Syntax
custom drop callout format/callout Required. An expression that returns a callout or callout
format object.
drop small real Required. The drop distance, in points.
Example
This example sets the custom drop distance to 14 points from the top of the text box.
set myDocument to worksheet 1
custom drop callout 1 of myDocument drop 14
Drawing Suite
304
Command: custom length
Specifies that the first segment of the callout line (the segment attached to the text callout box) retain
a fixed length whenever the callout is moved. To specify that the first segment of the callout line be
scaled automatically whenever the callout is moved, use the automatic length command. Applies
only to callouts whose lines consist of more than one segment (types callout three and callout four).
Syntax
custom length callout format/callout Required. An expression that returns a callout or callout
format object.
length small real Required. The length (in points) of the first segment of the callout.
Remarks
For the callout format object, applying this command sets the auto length property to false and sets
the callout format length property to the value specified for the length argument.
Example
This example toggles between an automatically scaling first segment and one with a fixed length for
the callout line for the first shape on
myDocument. For the example to work, the first shape must be a
callout.
set myDocument to worksheet 1
if auto length of callout format of callout 1 of myDocument is true then
custom length callout format of callout 1 of myDocument length 50
else
automatic length callout format of callout 1 of myDocument
end if
Command: cut (drawing)
Cuts the line, rectangle, oval, arc, or shape object to the Clipboard or pastes it into a specified
destination.
Syntax
cut line/rectangle/oval/arc/shape Required. An expression that returns one of the listed objects.
Example
This example cuts the first shape on Sheet1 and places it on the Clipboard.
cut shape 1 of worksheet "Sheet1"
Drawing Suite
305
Command: end connect
Attaches the end of the specified connector to a specified shape. If there's already a connection
between the end of the connector and another shape, that connection is broken. If the end of the
connector isn't already positioned at the specified connecting site, this command moves the end of
the connector to the connecting site and adjusts the size and position of the connector. To attach the
beginning of the connector to a shape, use the begin connect command.
Syntax
end connect connector format Required. An expression that returns a connector format object.
connected shape shape Required. The shape to attach the end of the connector to.
connection site integer Required. A connection site on the shape specified by connected shape. Must be an
integer between 1 and the integer returned by the connection site count property of the specified shape. If
you want the connector to automatically find the shortest path between the two shapes it connects,
specify any valid integer for this argument and then use the reroute connections command after the
connector is attached to shapes at both ends.
Remarks
When you attach a connector to an object, the size and position of the connector are automatically
adjusted, if necessary.
Example
This example adds two rectangles to myDocument and connects them with a curved connector.
Notice that the reroute connections command makes it irrelevant what values you supply for the
connection site arguments used with the begin connect and end connect commands.
set myDocument to worksheet 1
set firstRect to make new shape at end of myDocument ¬
with properties {auto shape type:autoshape rectangle, ¬
left position:100, top:50, width:200, height:100}
set secondRect to make new shape at end of myDocument ¬
with properties {auto shape type:autoshape rectangle, ¬
left position:300, top:300, width:200, height:100}
set c to make new shape connector at end of myDocument ¬
with properties {left position:0, top:0, width:100, ¬
height:100}
set connector format type of connector format of c to curve
begin connect connector format of c connected shape firstRect ¬
connection site 1
end connect connector format of c connected shape secondRect ¬
connection site 1
reroute connections c
Drawing Suite
306
Command: end disconnect
This command is not currently supported.
Command: flip
Flips the specified shape around its horizontal or vertical axis.
Syntax
flip shape Required. An expression that returns a shape object.
flip cmd enumeration Required. Specifies whether the shape is to be flipped horizontally or
vertically. Can be either flip horizontal or flip vertical.
Example
This example adds a triangle to
myDocument, duplicates the triangle, and then flips the duplicate
triangle vertically and makes it red.
set myDocument to sheet 1
set Triangle1 to make new shape at end of myDocument ¬
with properties {auto shape type:autoshape right triangle, ¬
left position:10, top:10, height:50, width:50}
set Triangle2 to make new shape at end of myDocument ¬
with properties {auto shape type:autoshape right triangle, ¬
left position:10, top:10, height:50, width:50}
set fore color of fill format of Triangle2 to {255,0,0}
flip Triangle2 flip cmd flip vertical
Command: one color gradient
Sets the specified fill to a one-color gradient.
Syntax
one color gradient fill format Required. An expression that returns a fill format object.
gradient style enumeration Required. The gradient style. Can be one of the following:
gradient unset
horizontal gradient
vertical gradient
diagonal up gradient
diagonal down gradient
from corner gradient
from title gradient (PowerPoint only)
from center gradient
Drawing Suite
307
variant integer Required. The gradient variant. Can be a value from 1 through 4, corresponding
to one of the four variants on the Gradient tab in the Fill Effects dialog box. If gradient style is
from center gradient, the variant argument can only be 1 or 2.
degree small real Required. The gradient degree. Can be a value from 0.0 (dark) through 1.0 (light).
Example
This example sets the fill format for shape 2 to the same style used for shape 1.
set cIf to fill format of shape 1 of sheet 1
if fill format type of cIf is fill gradient and gradient color type ¬
of cIf is single shade gradient type then
one color gradient fill format of shape 2 of sheet 1 ¬
gradient style (gradient style of cIf) variant gradient variant ¬
of cIf degree gradient degree of cIf
end if
Command: patterned
Sets the specified fill to a pattern.
Syntax
patterned fill format Required. An expression that returns a fill format object.
pattern enumeration Required. The pattern type. Can be one of the following:
pattern unset
five percent pattern
ten percent pattern
twenty percent pattern
twenty five percent pattern
thirty percent pattern
forty percent pattern
fifty percent pattern
sixty percent pattern
seventy percent pattern
seventy five percent pattern
eighty percent pattern
ninety percent pattern
dark horizontal pattern
dark vertical pattern
dark downward diagonal pattern
dark upward diagonal pattern
small checker board pattern
trellis pattern
light horizontal pattern
light vertical pattern
light downward diagonal pattern
light upward diagonal pattern
small grid pattern
dotted diamond pattern
wide downward diagonal
wide upward diagonal pattern
dashed upward diagonal pattern
dashed downward diagonal pattern
narrow vertical pattern
narrow horizontal pattern
dashed vertical pattern
dashed horizontal pattern
large confetti pattern
large grid pattern
horizontal brick pattern
large checker board pattern
small confetti pattern
zig zag pattern
solid diamond pattern
diagonal brick pattern
outlined diamond pattern
plaid pattern
sphere pattern
weave pattern
dotted grid pattern
divot pattern
shingle pattern
wave pattern
Drawing Suite
308
Example
This example sets the fill pattern for the first shape on sheet 1.
patterned fill format of shape 1 of sheet 1 pattern diagonal brick pattern
Command: pick up
Copies the formatting of the specified shape. To apply the copied formatting to another shape, use
the apply command.
Syntax
pick up shape Required. An expression that returns a shape object.
Example
This example copies the formatting of shape 1 on
myDocument and then applies the copied
formatting to shape 2.
set myDocument to worksheet 1
pick up shape 1 of myDocument
apply shape 2 of myDocument
Command: preset drop
Specifies whether the callout line attaches to the top, bottom, or center of the callout text box or
whether it attaches at a point that's a specified distance from the top or bottom of the text box.
Syntax
preset drop callout format/callout Required. An expression that returns a callout or callout
format object.
drop type enumeration Required. The starting position of the callout line relative to the text
bounding box. Can be one of the following: drop unset, drop custom, drop top, drop center,
or drop bottom. Specifying drop custom for this argument will cause your code to fail.
Example
This example specifies that the callout line should attach to the top of the text bounding box for the
first shape on
myDocument. For the example to work, the first shape must be a callout.
set myDocument to worksheet 1
preset drop callout 1 of myDocument drop type drop top
This example toggles between two preset drops for shape one on
myDocument. For the example to
work, shape one must be a callout.
set myDocument to worksheet 1
if drop type of callout format of callout 1 of myDocument is drop top then
preset drop callout 1 of myDocument drop type drop bottom
else if drop type of callout format of callout 1 of myDocument is drop bottom
then
preset drop callout 1 of myDocument drop type drop top
end if
Drawing Suite
309
Command: preset gradient
Sets the specified fill to a preset gradient.
Syntax
preset gradient fill format Required. An expression that returns a fill format object.
gradient style enumeration Required. The gradient style. Can be one of the following:
gradient unset
horizontal gradient
vertical gradient
diagonal up gradient
diagonal down gradient
from corner gradient
from title gradient (PowerPoint only)
from center gradient
variant integer Required. The gradient variant. Can be a value from 1 through 4, corresponding
to one of the four variants on the Gradient tab in the Fill Effects dialog box. If gradient style is
from center gradient, the variant argument can only be 1 or 2.
preset gradient type enumeration Required. The gradient type. Can be one of the following:
preset gradient unset
gradient early sunset
gradient late sunset
gradient nightfall
gradient daybreak
gradient horizon
gradient desert
gradient ocean
gradient calm water
gradient fire
gradient fog
gradient moss
gradient peacock
gradient wheat
gradient parchment
gradient mahogany
gradient rainbow
gradient rainbow2
gradient gold
gradient gold2
gradient brass
gradient chrome
gradient chrome2
gradient silver
gradient sapphire
Example
This example sets the fill format for shape 2 to the same style used for shape 1.
set cIf to fill format of shape 1 of sheet 1
if fill format type of cIf is fill gradient and ¬
gradient color type of cIf is preset colors gradient type then
preset gradient fill format of shape 2 of sheet 1 ¬
gradient style (gradient style of cIf) variant gradient variant ¬
of cIf preset gradient type (preset gradient type of cIf)
end if
Drawing Suite
310
Command: preset textured
Sets the specified fill format to a preset texture.
Syntax
preset textured fill format Required. An expression that returns a fill format object.
preset texture enumeration Required. The preset texture. Can be one of the following:
preset texture unset
texture papyrus
texture canvas
texture denim
texture woven mat
texture water droplets
texture paper bag
texture fish fossil
texture sand
texture green marble
texture white marble
texture brown marble
texture granite
texture newsprint
texture recycled paper
texture parchment
texture stationery
texture blue tissue paper
texture pink tissue paper
texture purple mesh
texture bouquet
texture cork
texture walnut
texture oak
texture medium wood
Example
This example sets the fill format for shape 2 to the same style used for shape 1.
set cIf to fill format of shape 1 of sheet 1
if fill format type of cIf is fill textured then
if texture type of cIf is texture type preset texture then
preset textured fill format of shape 2 of sheet 1 ¬
preset texture (preset texture of cIf)
end if
end if
Command: reroute connections
Reroutes connectors so that they take the shortest possible path between the shapes they connect. To
do this, the reroute connections command may detach the ends of a connector and reattach them to
different connecting sites on the connected shapes.
This command reroutes all connectors attached to the specified shape; if the specified shape is a
connector, it's rerouted.
Syntax
reroute connections shape Required. An expression that returns a shape object.
Remarks
If this command is applied to a connector, only that connector will be rerouted. If this command is
applied to a connected shape, all connectors to that shape will be rerouted.
Drawing Suite
311
Example
This example adds two rectangles to
myDocument, connects them with a curved connector, and then
reroutes the connector so that it takes the shortest possible path between the two rectangles. Note
that the reroute connections command adjusts the size and position of the connector and
determines which connecting sites it attaches to, so the values you initially specify for the
connection site arguments used with the begin connect and end connect commands are irrelevant.
set myDocument to worksheet 1
set firstRect to make new shape at end of myDocument ¬
with properties {auto shape type:autoshape rectangle, ¬
left position:100, top:50, width:200, height:100}
set secondRect to make new shape at end of myDocument ¬
with properties {auto shape type:autoshape rectangle, ¬
left position:300, top:300, width:200, height:100}
set c to make new shape connector at end of myDocument ¬
with properties {left position:0, top:0, width:100, ¬
height:100}
set connector format type of connector format of c to curve
begin connect connector format of c connected shape firstRect ¬
connection site 1
end connect connector format of c connected shape secondRect ¬
connection site 1
reroute connections c
Command: reset rotation
Resets the extrusion rotation around the x-axis and the y-axis to 0 (zero) so that the front of the
extrusion faces forward. This command doesn't reset the rotation around the z-axis.
Syntax
reset rotation threeD format Required. An expression that returns a threeD format object.
Remarks
To set the extrusion rotation around the x-axis and the y-axis to anything other than 0 (zero), use the
rotation x and rotation y properties of the threeD format object. To set the extrusion rotation around
the z-axis, use the rotation property of the shape object that represents the extruded shape.
Example
This example resets the rotation around the x-axis and the y-axis to 0 (zero) for the extrusion of
shape 1 on
myDocument.
set myDocument to worksheet 1
reset rotation threeD format of shape 1 of myDocument
Drawing Suite
312
Command: scale height
Scales the height of the shape by a specified factor. For pictures and OLE objects, you can indicate
whether you want to scale the shape relative to the original size or relative to the current size.
Shapes other than pictures and OLE objects are always scaled relative to their current height.
Syntax
scale height picture Required. An expression that returns a shape object.
factor small real Required. Specifies the ratio between the height of the shape after you resize it
and the current or original height. For example, to make a rectangle 50 percent larger, specify
1.5 for this argument.
relative to original size Boolean Required. True to scale the shape relative to its original size. False to scale
it relative to its current size. You can specify true for this argument only if the specified shape is a picture
or an OLE object.
[ scale enumeration] Optional. Specifies which part of the shape retains its position when the shape is
scaled. Can be one of the following: scale from bottom right, scale from middle, or scale from top left.
The default value is scale from top left.
Example
This example scales all pictures and OLE objects on
myDocument to 175 percent of their original
height, and it scales all other shapes to 175 percent of their current height.
set myDocument to worksheet 1
repeat with s in (get every shape in myDocument)
if shape type is shape type OLE control or ¬
shape type is shape type linked ole object or ¬
shape type is shape type embedded OLE control or ¬
shape type is shape type linked picture or ¬
shape type is shape type picture then
scale height s factor 1.75 relative to original size ¬
true scale scale from middle
else
scale height s factor 1.75 relative to original size ¬
false scale scale from middle
end if
end repeat
Drawing Suite
313
Command: scale width
Scales the width of the shape by a specified factor. For pictures and OLE objects, you can indicate
whether you want to scale the shape relative to the original size or relative to the current size.
Shapes other than pictures and OLE objects are always scaled relative to their current width.
Syntax
scale width picture Required. An expression that returns a shape object.
factor small real Required. Specifies the ratio between the width of the shape after you resize it
and the current or original height. For example, to make a rectangle 50 percent larger, specify
1.5 for this argument.
relative to original size Boolean Required. True to scale the shape relative to its original size. False to scale
it relative to its current size. You can specify true for this argument only if the specified shape is a picture
or an OLE object.
[scale enumeration] Optional. Specifies which part of the shape retains its position when the shape is
scaled. Can be one of the following: scale from bottom right, scale from middle, or scale from top left.
The default value is scale from top left.
Example
This example scales all pictures and OLE objects on
myDocument to 175 percent of their original
width, and it scales all other shapes to 175 percent of their current width.
set myDocument to worksheet 1
repeat with s in (get every shape in myDocument)
if shape type is shape type OLE control or ¬
shape type is shape type linked ole object or ¬
shape type is shape type embedded OLE control or ¬
shape type is shape type linked picture or ¬
shape type is shape type picture then
scale width s factor 1.75 relative to original size ¬
true scale scale from middle
else
scale width s factor 1.75 relative to original size ¬
false scale scale from middle
end if
end repeat
Command: send to back (drawing)
This command is not currently supported.
Drawing Suite
314
Command: set extrusion direction
Sets the direction that the extrusion's sweep path takes away from the extruded shape.
Syntax
set extrusion direction threeD format Required. An expression that returns a threeD format
object.
preset extrusion direction enumeration Required. Specifies the extrusion direction. Can be one
of the following:
extrude bottom
extrude bottom left
extrude bottom right
extrude left
extrude none
extrude right
extrude top
extrude top left
extrude top right
preset extrusion direction unset
Remarks
This command sets the preset extrusion direction property of the threeD format object to the direction
specified by the preset extrusion direction argument.
Example
This example specifies that the extrusion for shape 1 on
myDocument extend toward the top of the
shape and that the lighting for the extrusion come from the left.
set myDocument to sheet 1
set extrusion direction threeD format of shape 1 ¬
of myDocument preset extrusion direction extrude top
set preset lighting direction of threeD format ¬
of shape 1 of myDocument to light from left
Drawing Suite
315
Command: set shapes default properties
Applies the formatting for the specified shape to the default shape. Shapes created after this
command has been used will have this formatting applied by default.
Syntax
set shapes default properties shape Required. An expression that returns a shape object.
Example
This example adds a rectangle to
myDocument, formats the rectangle's fill, applies the rectangle's
formatting to the default shape, and then adds another smaller rectangle to the document. The
second rectangle has the same fill as the first one.
set myDocument to sheet 1
set myRect to make new shape at end of myDocument ¬
with properties {auto shape type: autoshape rectangle, ¬
top: 5, left position: 5, height:80, width: 60}
set fore color of fill format of myRect to (0,0,255)
set back color of fill format of myRect to (0,204,255)
patterned fill format of myRect pattern diagonal brick pattern
set shapes default properties myRect
make new shape at end of myDocument with properties ¬
{auto shape type: autoshape rectangle, top: 90, ¬
left position: 90, height:40, width: 30}
Command: set threed format
Sets the preset extrusion format. Each preset extrusion format contains a set of preset values for the
various properties of the extrusion.
Syntax
set threed format threeD format Required. An expression that returns a threeD format object.
preset threed format enumeration Required. Specifies a preset extrusion format that
corresponds to one of the options (numbered from left to right, from top to bottom) displayed
when you click the 3-D button on the Drawing toolbar. Can be one of the following:
preset threeD format unset
format1
format2
format3
format4
format5
format6
format7
format8
format9
format10
format11
format12
format13
format14
format15
format16
format17
format18
format19
format20
Drawing Suite
316
Remarks
This command sets the preset threeD format property of the threeD format object to the format
specified by the preset threed format argument.
Example
This example adds an oval to
myDocument and sets its extrusion format to 3D Style 12.
set myDocument to sheet 1
set myOval to make new shape at end of myDocument ¬
with properties {auto shape type: autoshape oval, ¬
top:30, left position:30, height:50, width:25}
set threed format threeD format of myOval ¬
preset threed format format12
Command: solid
Sets the specified fill to a uniform color. Use this command to convert a gradient, textured,
patterned, or background fill back to a solid fill.
Syntax
solid fill format Required. An expression that returns a fill format object.
Example
This example converts all fills on myDocument to uniform red fills.
set myDocument to worksheet 1
repeat with s in (get every shape in myDocument)
solid fill format of s
set fore color of fill format of s to {255, 0, 0}
end repeat
Command: toggle vertical text
Switches the text flow in the specified WordArt from horizontal to vertical, or vice versa.
Syntax
toggle vertical text word art format Required. An expression that returns a word art format
object.
Remarks
Using the toggle vertical text command swaps the values of the width and height properties of the
shape object that represents the WordArt and leaves the left position and top properties unchanged.
The flip command and rotation property of the shape object and the rotated chars property and
toggle vertical text command of the word art format object all affect the character orientation and
the direction of text flow in a shape object that represents WordArt. You may have to experiment to
find out how to combine the effects of these properties and commands to get the result you want.
Drawing Suite
317
Example
This example adds WordArt that contains the text "Test" to
myDocument and switches from
horizontal text flow (the default for the specified WordArt style, text effect 1) to vertical text flow.
set myDocument to sheet 1
set myWordArt to make new word art at end of myDocument ¬
with properties {preset word art effect: text effect1, ¬
word art text:"Test", font name: "Arial Black", ¬
font size: 36, bold: false, italic: false, ¬
left position: 100, top: 100}
toggle vertical text word art format of myWordArt
Command: two color gradient
Sets the specified fill to a two-color gradient.
Syntax
two color gradient fill format Required. An expression that returns a fill format object.
gradient style enumeration Required. The gradient style. Can be one of the following:
gradient unset
horizontal gradient
vertical gradient
diagonal up gradient
diagonal down gradient
from corner gradient
from title gradient (PowerPoint only)
from center gradient
variant integer Required. The gradient variant. Can be a value from 1 through 4, corresponding
to one of the four variants on the Gradient tab in the Fill Effects dialog box. If gradient style is
from center gradient, the variant argument can only be 1 or 2.
Example
This example sets the foreground color, background color, and gradient for the fill format on
shape 1.
set myDocument to sheet 1
set fore color of fill format of shape 1 ¬
of myDocument to (0,0,255)
set back color of fill format of shape 1 ¬
of myDocument to (0,204,255)
two color gradient fill format of shape 1 of myDocument ¬
gradient style horizontal gradient variant 1
Drawing Suite
318
Command: user picture
This command is not currently supported.
Command: user textured
Fills the specified shape with small tiles of an image. To fill the shape with one large image, use the
user picture command.
Syntax
user textured fill format Required. An expression that returns a fill format object.
[texture file Unicode text] Required. The name of the picture file.
Example
This example sets the fill format for shape 1 of sheet 1 to use the picture file "brick.gif" as the texture.
user textured fill format of shape 1 of sheet 1 texture file "brick.gif"
Command: z order
Moves the specified shape in front of or behind other shapes on the worksheet (that is, changes the
shape's position in the z-order).
Syntax
z order shape Required. An expression that returns a shape object.
z order command enumeration Required. Specifies where to move the specified shape relative
to the other shapes. Can be one of the following: bring shape to front, send shape to back,
bring shape forward, or send shape backward. The constants bring shape in front of text and
send shape behind text are used only in Microsoft Word.
Remarks
To determine a shape's current position in the z-order, use the z order position property of the shape
object.
Example
This example adds an oval to
myDocument and then places the oval second from the back in the
z-order if there is at least one other shape on the document.
set myDocument to sheet 1
set myOval to make new shape at end of myDocument ¬
with properties {auto shape type: autoshape oval, ¬
top:100, left position:100, height:100, width:300}
if z order position of myOval > 2 then
z order myOval z order command send shape backward
end if
Text Suite
319
Text Suite
Text Suite Classes .......................................................................................................................................................319
Text Suite Commands................................................................................................................................................326
Text Suite Classes
character ......................................................................................................................................................................319
font ...............................................................................................................................................................................320
style ..............................................................................................................................................................................322
Class: character
Plural
characters
Represents characters in an object that contains text. The character object lets you modify any
sequence of characters contained in the full text string.
Use character index, where index is the character number, to return a character object. Use characters
start thru end, where start is the start character number and end is the end character, to return a list of
character objects. The following example adds text to cell B1 and then makes the second word bold.
set value of range "B1" to "New Title"
set bold of font object of (characters 5 thru 9 of range "B1") to true
Properties
content
Returns or sets the text for the specified character. Read/write.
font object
Returns a font object that represents the font of the specified character. Read-only.
phonetic characters
Returns or sets the phonetic text in the specified character object. Read/write.
This property is available only in the Japanese version of Excel or in an English version of
Excel that you have registered as Japanese by using the Microsoft Language Register
application.
Text Suite
320
Class: font
Plural
fonts
Contains the font attributes (font name, font size, color, and so on) for an object.
Use the font object property to return the font object. The following example formats cells A1:C5 as
bold.
set bold of font object of range "A1:C5" of worksheet "sheet1" to true
If you don't want to format all the text in a cell or graphic the same way, use the character class to
return a subset of the text.
Properties
bold
True if the font is bold. Read/write.
color
Returns or sets the primary color of the font as an RGB value. Read/write.
font background
Returns or sets the text background type. Read/write.
Can be one of the following:
background automatic
background opaque
background transparent
font color index
Returns or sets the color of the font. The color is specified as an index value into the current
color palette. You can also use color index none to specify that you don't want a color, or use
color index automatic to specify the automatic color (for text).
This property specifies a color as an index into the workbook color palette. The following
illustration shows the color-index values in the default color palette.
Text Suite
321
font size
Returns or sets the font size, in points. Read/write.
font style
Returns or sets the font style. Read/write.
Changing this property may affect other font properties (such as bold and italic).
italic
True if the font style is italic. Read/write.
name
Returns or sets the name associated with the font object. Read/write.
outline font
True if the font is an outline font. Read/write.
shadow
True if the font is a shadow font or is formatted with a shadow effect. Read/write.
strikethrough
True if the font is struck through with a horizontal line. Read/write.
subscript
True if the font is formatted as subscript. False by default. Read/write.
superscript
True if the font is formatted as superscript. False by default. Read/write.
underline
Returns or sets the type of underline applied to the font. Read/write.
Can be one of the following:
underline style double
underline style double accounting
underline style none
underline style single
underline style single accounting
Text Suite
322
Class: style
Plural
styles
Represents a style description for a range. The style object contains all style attributes (font, number
format, alignment, and so on) as properties. There are several built-in styles, including Normal,
Currency, and Percent. Using the style object is a fast and efficient way to change several cell-
formatting properties on multiple cells at the same time.
Use the style object property to return the style object used with a range object. The following
example applies the Percent style to cells A1:A10 on Sheet1.
set style object of range "A1:A10" of worksheet "Sheet1" to ¬
style "Percent" of active workbook
You can change the appearance of a cell by changing properties of the style applied to that cell.
Keep in mind, however, that changing a style property will affect all cells already formatted with
that style.
Use style index, where index is the style index number or name, to return a single style object from
the workbook's list of styles. The following example changes the Normal style for the active
workbook by setting the style's bold property.
set bold of font object of style "Normal" of active workbook to true
Styles are sorted alphabetically by style name. The style index number denotes the position of the
specified style in the sorted list of style names.
Style 1 is the first style in the alphabetical list, and
style (get count of styles) is the last one in the list.
Properties
add indent
This property is not used in U.S./English versions of Excel.
built in
True if the style is a built-in style. Read-only.
font object
Returns a font object that represents the font of the specified style. Read-only.
formula hidden
True if the formula will be hidden when the workbook or worksheet is protected. Read/write.
Text Suite
323
horizontal alignment
Returns or sets the horizontal alignment for the object. Read/write.
Can be one of the following:
horizontal align center
horizontal align center across selection
horizontal align distributed
horizontal align fill
horizontal align general
horizontal align justify
horizontal align left
horizontal align right
The horizontal align distributed alignment style works only in the Japanese version of Excel
or in an English version of Excel that you have registered as Japanese by using the Microsoft
Language Register application.
include alignment
True if the style includes the add indent, horizontal alignment, vertical alignment, wrap text, and
orientation properties. Read/write.
include border
True if the style includes the color, color index, line style, and weight border properties.
Read/write.
include font
True if the style includes the font background, bold, color, color index, font style, italic, name, outline
font, shadow, font size, strikethrough, subscript, superscript, and underline font properties.
Read/write.
include number
True if the style includes the number format property. Read/write
include patterns
True if the style includes the color, color index, invert if negative, pattern, pattern color, and pattern
color index interior properties. Read/write
include protection
True if the style includes the formula hidden and locked protection properties. Read/write.
indent level
Returns or sets the indent level for the style. Can be an integer from 0 to 15. Read/write.
Using this property to set the indent level to a number less than 0 (zero) or greater than 15
causes an error.
Text Suite
324
interior object
Returns an interior object that represents the interior of the style. Read-only.
locked
True if the style is locked; false if the style can be modified when the sheet is protected.
Returns missing value if the specified range contains both locked and unlocked cells.
Read/write.
merged cells
True if the style contains merged cells. Read/write.
name
Returns the name associated with the style object. Read-only.
name local
Returns the name of the style, in the language of the user. Read-only.
If the style is a built-in style, this property returns the name of the style in the language of the
current locale.
number format
Returns or sets the format code for the style. Returns missing value if all cells in the specified
range don't have the same number format. Read/write.
The format code is the same string as the Format Codes option in the Format Cells dialog box.
The Format function uses different format code strings than do the number format and number
format local properties.
number format local
Returns or sets the format code for the style as a string in the language of the user. Read/write.
The format code is the same string as the Format Codes option in the Format Cells dialog box.
The Format function uses different format code strings than do the number format and number
format local properties.
orientation
Returns or sets the style's orientation. Read/write.
Can be one of the following:
orientation down
orientation horizontal
orientation upward
orientation vertical
Can also be a number value between -90 and 90 degrees.
reading order
This property is not currently supported.
Text Suite
325
shrink to fit
True if text automatically shrinks to fit in the available column width. Returns missing value
if this property isn't set to the same value for all cells in the specified range. Read/write.
value
Returns or sets the name of the specified style. Read/write.
vertical alignment
Returns or sets the vertical alignment of the style. Read/write.
Can be one of the following:
valign top
valign center
valign bottom
valign justify
valign distributed
The valign distributed alignment style works only in the Japanese version of Excel or in an
English version of Excel that you have registered as Japanese by using the Microsoft Language
Register application.
wrap text
True if Excel wraps the text in the style. Returns missing value if the specified range contains
some cells that wrap text and other cells that don't. Read/write.
Excel will change the row height of the range, if necessary, to accommodate the text in the
range.
.
Text Suite
326
Text Suite Commands
get border (text) ..........................................................................................................................................................326
insert into.....................................................................................................................................................................326
Command: get border (text)
This command is not currently supported
Command: insert into
Inserts a string preceding the selected characters.
Syntax
insert into character Required. An expression that returns a character object.
string Unicode text Required. The string to insert.
Example
This example inserts a string after character 5 in cell B1.
insert into (character 5 of range "B1") string "and improved"
Table Suite
327
Table Suite
Table Suite Classes .....................................................................................................................................................327
Table Suite Commands..............................................................................................................................................338
Table Suite Classes
cell ................................................................................................................................................................................327
column .........................................................................................................................................................................327
range ............................................................................................................................................................................328
row ...............................................................................................................................................................................337
Class: cell
Plural
cells
Represents a cell in a range.
Use cell index, where index is the cell number, to return a single cell object. The following example
sets the cell B1 to a given formula.
set formula of cell "B1" to "=A1+A2"
Properties
<Inheritance> range
Inherits the properties and elements of the range class.
Class: column
Plural
columns
Represents a column in a range.
Use column index, where index is the name or column letter range, to return a single column object.
The following example sets all of the cells in column B to a given formula.
set formula of column "B:B" to "=A1+A2"
Properties
<Inheritance> range
Inherits the properties and elements of the range class.
Table Suite
328
Class: range
Plural
ranges
Elements
range
cell
row
column
character
format condition
hyperlink
Represents a cell, a row, a column, a selection of cells containing one or more contiguous blocks of
cells, or a 3-D range.
Use range index, where index names the range, to return a range object that represents a single cell or
a range of cells. The following example places the value of cell A1 in cell A5.
set value of range "A5" of active sheet to ¬
(get value of range "A1" of active sheet)
The following example fills the range A1:H8 with random numbers by setting the formula for each
cell in the range. When it's used without an object qualifier (an object of
another object), the range
object returns a range on the active sheet. If the active sheet isn't a worksheet, the script fails. Use the
activate object command to activate a worksheet before you use the range object without an explicit
object qualifier.
activate object worksheet "sheet1"
set formula of range "A1:H8" to "=rand()"
The following example clears the contents of the range named "Criteria."
clear contents range "Criteria" of worksheet 1
If you use a text argument for the range address, you must specify the address in A1-style notation
(you cannot use R1C1-style notation). For more information about how to reference cells and
ranges, see the topic "How to reference cells and ranges."
Properties
Excel comment
Returns a comment object that represents the comment associated with the cell in the upper-
left corner of the range. Read-only.
add indent
This property is not used in U.S./English versions of Excel.
Table Suite
329
areas
Returns a list of range objects that represent all the ranges in a multiple-area selection. Read-
only.
column width
Returns or sets the width of all columns in the specified range. Read/write.
One unit of column width is equal to the width of one character in the Normal style. For
proportional fonts, the width of the character 0 (zero) is used. Use the width property to return
the width of a column in points. If all columns in the range have the same width, the column
width property returns the width. If columns in the range have different widths, this property
returns missing value.
current array
If the specified cell is part of an array, returns a range object that represents the entire array.
Read-only.
current region
Returns a range object that represents the current region. The current region is a range
bounded by any combination of blank rows and blank columns. Read-only.
This property is useful for many operations that automatically expand the selection to include
the entire current region, such as the autoformat command.
dependents
Returns a range object that represents the range containing all the dependents of a cell. This
can be a multiple selection (a list of range objects) if there's more than one dependent. Read-
only.
direct dependents
Returns a range object that represents the range containing all the direct dependents of a cell.
This can be a multiple selection (a list of range objects) if there's more than one dependent.
Read-only.
direct precedents
Returns a range object that represents the range containing all the direct precedents of a cell.
This can be a multiple selection (a list of range objects) if there's more than one precedent.
Read-only.
entire column
Returns a range object that represents the entire column (or columns) that contains the
specified range. Read-only.
entire row
Returns a range object that represents the entire row (or rows) that contains the specified
range. Read-only.
first column index
Returns the number of the first column in the first area in the specified range. Read-only.
Table Suite
330
first row index
Returns the number of the first row in the first area in the specified range. Read-only.
font object
Returns a font object that represents the font of the specified range. Read-only.
formula
Returns or sets the formula of the range object in A1-style notation. Read/write.
If the cell contains a constant, this property returns the constant. If the cell is empty, formula
returns an empty string. If the cell contains a formula, formula returns the formula as a string,
in the same format in which it would be displayed in the formula bar (including the equal
sign).
If you set the value or formula of a cell to a date, Excel checks to see whether that cell is
already formatted with one of the date or time number formats. If not, Excel changes the
number format to the default short date number format.
Setting the formula for a multiple-cell range fills all cells in the range with the formula.
formula array
Returns or sets the array formula of a range. Returns (or can be set to) a single formula or an
array. If the specified range doesn't contain an array formula, this property returns missing
value. Read/write.
If you use this property to enter an array formula, the formula must use the R1C1 reference
style, not the A1 reference style.
formula hidden
True if the formula will be hidden when the workbook or worksheet is protected. Read/write.
Don't confuse this property with the hidden property.
formula label
Returns or sets the formula label type for the specified range. Can be no labels if the range
contains no labels, or one of the following: row labels, column labels, or mixed labels.
Read/write.
formula local
Returns or sets the formula for the range, using A1-style references in the language of the user.
Read/write.
If the cell contains a constant, this property returns that constant. If the cell is empty, the
property returns an empty string. If the cell contains a formula, the property returns the
formula as a string, in the same format in which it would be displayed in the formula bar
(including the equal sign).
If you set the value or formula of a cell to a date, Excel checks to see whether that cell is
already formatted with one of the date or time number formats. If not, the number format is
changed to the default short date number format.
Setting the formula of a multiple-cell range fills all cells in the range with the formula.
Table Suite
331
formula r1c1
Returns or sets the formula for the range, using R1C1-style notation. Read/write.
If the cell contains a constant, this property returns the constant. If the cell is empty, the
property returns an empty string. If the cell contains a formula, the property returns the
formula as a string, in the same format in which it would be displayed in the formula bar
(including the equal sign).
If you set the value or formula of a cell to a date, Excel checks to see whether that cell is
already formatted with one of the date or time number formats. If not, the number format is
changed to the default short date number format.
Setting the formula of a multiple-cell range fills all cells in the range with the formula.
formula r1c1 local
Returns or sets the formula for the range, using R1C1-style notation in the language of the
user. Read/write.
If the cell contains a constant, this property returns that constant. If the cell is empty, the
property returns an empty string. If the cell contains a formula, the property returns the
formula as a string, in the same format in which it would be displayed in the formula bar
(including the equal sign).
If you set the value or formula of a cell to a date, Excel checks to see whether that cell is
already formatted with one of the date or time number formats. If not, the number format is
changed to the default short date number format.
Setting the formula of a multiple-cell range fills all cells in the range with the formula.
has array
True if the specified range is part of an array formula. Read-only.
has formula
True if and only if every cell in the specified range contains a formula. Read-only.
height
Returns the height of the range. Read-only.
hidden
True if the rows or columns are hidden. The specified range must span an entire column or
row. Read/write.
Don't confuse this property with the formula hidden property.
Table Suite
332
horizontal alignment
Returns or sets the horizontal alignment for the object. Read/write.
Can be one of the following:
horizontal align center
horizontal align center across selection
horizontal align distributed
horizontal align fill
horizontal align general
horizontal align justify
horizontal align left
horizontal align right
The horizontal align distributed alignment style works only in the Japanese version of Excel
or in an English version of Excel that you have registered as Japanese by using the Microsoft
Language Register application.
indent level
Returns or sets the indent level for the range or style. Can be an integer from 0 to 15.
Read/write.
interior object
Returns an interior object that represents the interior of the range. Read-only.
left position
Returns or sets the position (in points) of the specified range. Read/write.
list header rows
Returns the number of header rows for the specified range. Read-only.
list object
Returns a list object object that represents the list containing the upper-left corner of a
specified range. Read-only.
Table Suite
333
location in table
If there is a PivotTable report on the sheet, returns a constant that describes the part of the
PivotTable report that contains the upper-left corner of the specified range. Read-only.
Can be one of the following:
column header
column item
data header
data item
page header
page item
row header
row item
table body
locked
True if and only if every cell in the specified range is locked. Read/write.
merge area
Returns a range object that represents the merged range containing the specified cell. If the
specified cell isn't in a merged range, this property returns the specified cell. Read-only.
merge cells
True if the range contains merged cells. Read/write.
name
Returns or sets the name of the range. Read/write.
named item
Returns the named item associated with this range. Read-only.
number format
Returns or sets the number format code for the range. Returns missing value if all cells in the
specified range don't use the same number format code. Read/write.
For a list of existing number format codes, click the Custom category on the Number tab of the
Format Cells dialog box (Format menu, Cells command).
number format local
Returns or sets the number format code for the range as a string in the language of the user.
Read/write.
For a list of existing number format codes, click the Custom category on the Number tab of the
Format Cells dialog box (Format menu, Cells command).
Table Suite
334
outline level
Returns or sets the current outline level of the specified row or column. Read/write.
Level one is the outermost summary level.
page break
Returns or sets the location of a page break. Can be one of the following: page break
automatic, page break manual, or page break none.
This property can return the location of either automatic or manual page breaks, but it can
only set the location of manual breaks (it can only be set to page break manual or page break
none).
To remove all manual page breaks on a worksheet:
set page break of (every range of
active sheet) to page break none
phonetic object
Returns the phonetic object, which contains information about a specific phonetic text string in
a specified range.
This property is available only in the Japanese version of Excel or in an English version of
Excel that you have registered as Japanese by using the Microsoft Language Register
application.
pivot field
Returns a pivot field object that represents the pivot field containing the upper-left corner of
the specified range. Read-only.
pivot item
Returns a pivot item object that represents the pivot item containing the upper-left corner of
the specified range. Read-only.
pivot table
Returns a pivot table object that represents the PivotTable containing the upper-left corner of
the specified range. Read-only.
precedents
Returns a range object that represents all the precedents of a cell. This can be a multiple
selection (a list of range objects) if there's more than one precedent. Read-only.
prefix character
Returns the prefix character for the range. Read-only.
query table
Returns a query table object that represents the query table that intersects the specified range.
Read-only.
reading order
This property is not currently supported.
Table Suite
335
row height
Returns the height (in points) of all the rows in the range specified. Returns missing value if
the rows in the specified range aren't all the same height. Read/write.
For a single row, the value of the height property is equal to the value of the row height
property. However, you can also use the height property to return the total height of a range of
cells.
In addition, the height property is read-only, and if you return the row height property of
several rows, you will get either the row height of each of the rows (if all the rows are the same
height) or missing value (if they're different heights). If you return the height property of
several rows, you will get the total height of all the rows.
show detail
True if the outline is expanded for the specified range (so that the detail of the column or row
is visible). The specified range must be a single summary column or row in an outline.
Read/write. If the range object is in a PivotTable report, this property is true if the pivot item
is showing detail.
If the specified range isn't in a PivotTable report, the following remarks apply:
The range must be in a single summary row or column.
This property returns false if any of the children of the row or column are hidden.
Setting this property to true is equivalent to unhiding all the children of the
summary row or column.
Setting this property to false is equivalent to hiding all the children of the summary
row or column.
If the specified range is in a PivotTable, it's possible to set this property for more than one cell
at a time if the range is contiguous. This property can be returned only if the range is a single
cell.
shrink to fit
True if text automatically shrinks to fit in the available column width. Returns missing value
if this property isn't set to the same value for all cells in the specified range. Read/write.
string value
Returns the text for the range. Read-only.
style object
Returns a style object that represents the style of the specified range. Read-only.
summary
True if the range is an outlining summary row or column. The range should be a row or a
column. Read-only.
text orientation
Returns or sets the text orientation. Can be a number value from -90 to 90 degrees. Read/write.
Table Suite
336
top
Returns or sets the top position (in points) of the specified object. Read/write.
use standard height
True if the row height of the range object equals the standard height of the sheet. Returns
missing value if the range contains more than one row and the rows aren't all the same height.
Read/write.
use standard width
True if the column width of the range object equals the standard width of the sheet. Returns
missing value if the range contains more than one column and the columns aren't all the same
width. Read/write.
validation
Returns the validation object that represents data validation for the specified range. Read-
only.
value
If the range is a single cell, returns or sets the value of the specified cell. If the cell is empty,
value returns an empty string. If the range object contains more than one cell, returns a list of
values. Each internal list within the outer list corresponds to a row of cell values. The value of
a single row returns a list containing a single internal list of cell values.
vertical alignment
Returns or sets the vertical alignment of the object. Read/write.
Can be one of the following:
vertical alignment top
vertical alignment center
vertical alignment bottom
vertical alignment justify
vertical alignment distributed
The vertical alignment distributed alignment style works only in the Japanese version of
Excel or in an English version of Excel that you have registered as Japanese by using the
Microsoft Language Register application.
width
Returns or sets the width of the specified range, in points. Read/write.
worksheet object
Returns a worksheet object that represents the worksheet containing the specified range.
Read-only.
wrap text
True if Excel wraps the text in the range. Returns missing value if the specified range contains
some cells that wrap text and other cells that don't. Read/write.
Excel will change the row height of the range, if necessary, to accommodate the text in the
range.
Table Suite
337
Class: row
Plural
rows
Represents a row in a range.
Use row index, where index is the name or row number range, to return a single row object. The
following example sets all of the cells in row 3 to a given formula.
set formula of row "3:3" to "=A1+A2"
Properties
<Inheritance> range
Inherits the properties and elements of the range class.
.
Table Suite
338
Table Suite Commands
activate object (table).................................................................................................................................................. 339
add comment .............................................................................................................................................................. 339
advanced filter ............................................................................................................................................................ 340
apply names ................................................................................................................................................................340
apply outline styles ....................................................................................................................................................341
autocomplete............................................................................................................................................................... 341
autofill..........................................................................................................................................................................342
autofilter range ...........................................................................................................................................................342
autofit........................................................................................................................................................................... 343
autoformat................................................................................................................................................................... 344
auto outline .................................................................................................................................................................345
border around............................................................................................................................................................. 345
calculate (table)...........................................................................................................................................................346
check spelling (table).................................................................................................................................................. 347
clear contents (table) ..................................................................................................................................................347
clear Excel comments................................................................................................................................................. 347
clear outline.................................................................................................................................................................348
clear range ...................................................................................................................................................................348
clear range formats.....................................................................................................................................................348
column differences.....................................................................................................................................................348
consolidate...................................................................................................................................................................349
copy picture (table) ....................................................................................................................................................350
copy range ................................................................................................................................................................... 350
create names................................................................................................................................................................351
cut range...................................................................................................................................................................... 351
data series....................................................................................................................................................................352
data table .....................................................................................................................................................................352
delete range.................................................................................................................................................................353
fill down.......................................................................................................................................................................353
fill left...........................................................................................................................................................................354
fill right ........................................................................................................................................................................354
fill up............................................................................................................................................................................ 354
find ............................................................................................................................................................................... 355
find next.......................................................................................................................................................................356
find previous...............................................................................................................................................................357
function wizard ..........................................................................................................................................................358
get address ..................................................................................................................................................................358
get address local ......................................................................................................................................................... 359
get border (table) ........................................................................................................................................................359
get end .........................................................................................................................................................................360
get offset ......................................................................................................................................................................360
get resize......................................................................................................................................................................361
get XML value............................................................................................................................................................. 361
goal seek ......................................................................................................................................................................361
group............................................................................................................................................................................ 362
insert indent ................................................................................................................................................................363
insert into range..........................................................................................................................................................363
justify ...........................................................................................................................................................................364
list names.....................................................................................................................................................................364
merge ...........................................................................................................................................................................364
navigate arrow............................................................................................................................................................ 365
parse.............................................................................................................................................................................365
paste special ................................................................................................................................................................366
print out (table)...........................................................................................................................................................367
print preview (table) .................................................................................................................................................. 367
Table Suite
339
remove subtotal .......................................................................................................................................................... 368
replace..........................................................................................................................................................................368
row differences ...........................................................................................................................................................369
run VB macro (table).................................................................................................................................................. 369
set XML value .............................................................................................................................................................370
show (table)................................................................................................................................................................. 370
show dependents........................................................................................................................................................ 370
show errors.................................................................................................................................................................. 371
show precedents.........................................................................................................................................................371
sort................................................................................................................................................................................ 371
sort special...................................................................................................................................................................373
special cells.................................................................................................................................................................. 374
subtotal ........................................................................................................................................................................375
text to columns............................................................................................................................................................ 375
ungroup .......................................................................................................................................................................377
unmerge.......................................................................................................................................................................378
Command: activate object (table)
Activates a single cell, which must be inside the current selection.
Syntax
activate range Required. An expression that returns a range object.
Example
This example changes the active cell within the selected range to cell B4.
select range "B3:B5"
activate object range "B4"
Command: add comment
Adds a comment to the range.
Syntax
add comment range Required. An expression that returns a range object.
[comment text Unicode text] Optional. The comment text.
Example
This example adds a comment to cell E5 on the active worksheet.
add comment (range "E5" of active sheet) comment text "Current Sales"
Table Suite
340
Command: advanced filter
Filters or copies data from a list based on a criteria range. If the initial selection is a single cell, that
cell's current region is used.
Syntax
advanced filter range Required. An expression that returns a range object.
action enumeration Required. The filter operation. Can be one of the following: filter copy or
filter in place.
[criteria range range] Optional. The criteria range. If this argument is omitted, there are no criteria. Can be
a range object, an A1-style range reference, a named range, or a list of category names.
[copy to range range] Optional. The destination range for the copied rows if action is filter copy.
Otherwise, this argument is ignored. Can be a range object, an A1-style range reference, a named range,
or a list of category names.
[unique Boolean] Optional. True to filter unique records only. False to filter all records that meet the
criteria. The default value is false.
Example
This example filters a database (named "Database") based on a criteria range named "Criteria."
advanced filter range "Database" action filter in place ¬
criteria range range "Criteria"
Command: apply names
Applies names to the cells in the specified range.
Syntax
apply names range Required. An expression that returns a range object.
[names list] Optional. A list of the names to be applied. If this argument is omitted, all names on
the sheet are applied to the range.
[ignore relative absolute Boolean] Optional. True to replace references with names, regardless of the
reference types of either the names or references. False to replace absolute references only with absolute
names, relative references only with relative names, and mixed references only with mixed names. The
default value is true.
[use row column names Boolean] Optional. True to use the names of row and column ranges that contain
the specified range if names for the range cannot be found. False to ignore the omit column and omit
row arguments. The default value is true.
[omit column Boolean] Optional. True to replace the entire reference with the row-oriented name. The
column-oriented name can be omitted only if the referenced cell is in the same column as the formula
and is within a row-oriented named range. The default value is true.
Table Suite
341
[omit row Boolean] Optional. True to replace the entire reference with the column-oriented name. The row-
oriented name can be omitted only if the referenced cell is in the same row as the formula and is within a
column-oriented named range. The default value is true.
[order enumeration] Optional. Determines which range name is listed first when a cell reference is replaced
by a row-oriented and column-oriented range name. Can be one of the following: row then column or
column then row.
[append last Boolean] Optional. True to replace the definitions of the names in names and also replace the
definitions of the last names that were defined. False to replace the definitions of the names in names
only. The default value is false.
Remarks
You cannot "unapply" names; to delete names, use the delete command.
Example
This example applies names to the entire sheet.
apply names (cells of active sheet) names {"Sales", "Profits"}
Command: apply outline styles
Applies outlining styles to the specified range.
Syntax
apply outline styles range Required. An expression that returns a range object.
Example
The following example applies automatic outlining styles to range A1:E6. The range must include
the entire outline range on a worksheet.
apply outline styles range "A1:E6"
Command: autocomplete
Returns an AutoComplete match from the list. If there's no AutoComplete match or if more than
one entry in the list matches the string to complete, this command returns an empty string.
Syntax
autocomplete range Required. An expression that returns a range object (must be a single cell).
string Unicode text Required. The string to complete.
Remarks
This command works even if the AutoComplete feature is disabled.
Table Suite
342
Example
This example returns the AutoComplete match for the string segment "Ap." An AutoComplete
match is made if the column containing cell A5 contains a contiguous list and one of the entries in
the list contains a match for the string.
set suggest to autocomplete range "A2" string "Ap"
if (suggest "") then
display dialog "Completes to " & suggest
else
display dialog "Has no completion"
end if
Command: autofill
Performs an AutoFill on the cells in the specified range.
Syntax
autofill range Required. An expression that returns a range object.
destination range Required. The cells to be filled. The destination must include the source
range. Can be a range object, an A1-style range reference, a named range, or a list of category
names.
[type enumeration] Optional. Specifies the fill type. Can be one of the following: fill copy, fill days, fill
default, fill formats, fill months, fill series, fill values, fill weekdays, fill years, growth trend, or linear
trend. If this argument is fill default or omitted, Excel selects the most appropriate fill type based on the
source range.
Example
This example performs an AutoFill on cells A1:A20 on Sheet1, based on the source range A1:A2 on
Sheet1. Before running this example, type 1 in cell A1 and type 2 in cell A2.
autofill range "A1:A2" destination range "A1:A20"
Command: autofilter range
Filters a list using the AutoFilter.
Note To return an autofilter object, apply the autofilter object property to a sheet object.
Syntax
autofilter range range Required. An expression that returns a range object.
[field integer] Optional. The integer offset of the field on which you want to base the filter (from
the left of the list; the leftmost field is field one).
[criteria1 Unicode text] Optional. The criterion (a string; for example, "101"). If operator is top 10 items,
criteria1 specifies the number of items (for example, "10").
Table Suite
343
[operator enumeration] Optional. Can be one of the following: autofilter and, bottom 10 items, bottom 10
percent, autofilter or, top 10 items, or top 10 percent. Use autofilter and and autofilter or with criteria1
and criteria2 to construct compound criteria.
[criteria2 Unicode text] Optional. The second criterion (a string). Used with criteria1 and operator to
construct compound criteria.
[visible drop down Boolean] Optional. True to display the AutoFilter drop-down arrow for the filtered
field. False to hide the AutoFilter drop-down arrow for the filtered field. True by default.
Remarks
If you omit all the arguments, this command toggles the display of the AutoFilter drop-down
arrows in the specified range.
Example
This example filters a list starting in cell A1 on Sheet1 to display only the entries in which field 1 is
equal to the string "Otis". The drop-down arrow for field 1 will be hidden.
autofilter range (range "A1" of worksheet "Sheet1") field 1 criteria1 "Otis" ¬
without visible drop down
Command: autofit
Changes the width of the columns in the range or the height of the rows in the range to achieve the
best fit.
Syntax
autofit range Required. An expression that returns a range object. Must be a row or a range of
rows, or a column or a range of columns. Otherwise, this command generates an error.
Remarks
One unit of column width is equal to the width of one character in the Normal style.
Example
This example changes the width of columns A through I on Sheet1 to achieve the best fit.
autofit every column of range "A:I"
This example changes the width of columns A through E on Sheet1 to achieve the best fit, based
only on the contents of cells A1:E1.
autofit every column of range "A1:E1"
Table Suite
344
Command: autoformat
Automatically formats a range of cells, using a predefined format.
Syntax
autoformat range Required. An expression that returns a range object.
[format enumeration] Optional. The range format to be used.
Can be one of the following:
range autoformat threeD effects 1
range autoformat threeD effects 2
range autoformat accounting 1
range autoformat accounting 2
range autoformat accounting 3
range autoformat accounting 4
range autoformat classic 1
range autoformat classic 2
range autoformat classic 3
range autoformat color 1
range autoformat color 2
range autoformat color 3
range autoformat list 1
range autoformat list 2
range autoformat list 3
range autoformat local format 1
range autoformat local format 2
range autoformat local format 3
range autoformat local format 4
range autoformat none
range autoformat simple
The default value is range autoformat classic 1. The range autoformat local format 1, range
autoformat local format 2, range autoformat local format 3, and range autoformat local
format 4 values are not used in the U.S. English version of Excel.
[number Boolean] Optional. True to include number formats in the autoformat. The default
value is true.
[font Boolean] Optional. True to include font formats in the autoformat. The default value is true.
[alignment Boolean] Optional. True to include alignment in the autoformat. The default value is true.
[border Boolean] Optional. True to include border formats in the autoformat. The default value is true.
[pattern Boolean] Optional. True to include pattern formats in the autoformat. The default value is true.
[width Boolean] Optional. True to include column width and row height in the autoformat. The default
value is true.
Example
This example formats cells A1:D8 on Sheet1, using a predefined format.
autoformat range "A1:D8" format range autoformat classic 1
Table Suite
345
Command: auto outline
Automatically creates an outline for the specified range. If the range is a single cell, Excel creates an
outline for the entire sheet. The new outline replaces any existing outline.
Syntax
auto outline range Required. An expression that returns a range object.
Example
This example creates an outline for the range A1:G37 on Sheet1. The range must contain either a
summary row or a summary column.
auto outline range "A1:G37" of sheet "Sheet1"
Command: border around
Adds a border to a range and sets the color, line style, and weight properties for the new border.
Syntax
border around range Required. An expression that returns a range object.
[line style enumeration] Optional. The line style for the border. The default value is continuous.
Can be one of the following:
continuous
dash
dash dot
dash dot dot
dot
double
slant dash dot
line style none
[weight enumeration] Optional. The border weight. The default value is border weight thin.
Can be one of the following:
border weight hairline
border weight medium
border weight thick
border weight thin
Table Suite
346
[color index enumeration] Optional. The border color. The color is specified as an index value
into the current color palette, or as one of the following:
color index automatic
color index none
The following illustration shows the color-index values in the default color palette.
[color RGB color] Optional. The border color, as an RGB value.
Remarks
You can specify either color index or color, but not both. If you don't specify either argument, Excel
uses the color index automatic color index value.
Similarly, you can specify either line style or weight, but not both. If you don't specify either
argument, Excel creates a default border.
This command outlines the entire range without filling it in. To set the borders of all the cells, you
must set the color, line style, and weight properties for the list of border objects on the worksheet. To
clear the border, you must set the line style property to line style none for all the cells in the range.
Example
This example adds a thick red border around the range A2:D4 on Sheet1.
border around range "A2:D4" color index 3 weight border weight thick
Command: calculate (table)
Calculates a specified range of cells on a worksheet.
Syntax
calculate range An expression that returns a range object.
Example
This example calculates the formulas in columns A, B, and C in the used range on Sheet1.
calculate columns 1 through 3 of used range
Table Suite
347
Command: check spelling (table)
Checks the spelling of text in a range. This form has no return value; Excel displays the Spelling
dialog box.
check spelling range Required. An expression that returns a range object.
[custom dictionary Unicode text] Optional. A string that indicates the file name of the custom
dictionary to examine if the word isn't found in the main dictionary. If this argument is
omitted, the currently specified dictionary is used.
[ignore uppercase Boolean] Optional. True to have Excel ignore words that are all uppercase. False to have
Excel check words that are all uppercase. If this argument is omitted, the current setting will be used.
[always suggest Boolean] Optional. True to have Excel display a list of suggested alternate spellings when
an incorrect spelling is found. False to have Excel wait for you to input the correct spelling. If this
argument is omitted, the current setting will be used.
Example
This example checks the spelling on Sheet1.
check spelling range "A1:G10" of sheet "Sheet1"
Command: clear contents (table)
Clears the formulas from the range.
Syntax
clear contents range Required. An expression that returns a range object.
Example
This example clears the formulas from cells A1:G37 on Sheet1 but leaves the formatting intact.
clear contents range "A1:G37" of sheet "Sheet1"
Command: clear Excel comments
Clears all cell comments from the specified range.
Syntax
clear Excel comments range Required. An expression that returns a range object.
Example
This example clears all comments from cell E5.
clear Excel comments range "E5" of sheet 1
Table Suite
348
Command: clear outline
Clears the outline for the specified range.
Syntax
clear outline range Required. An expression that returns a range object.
Example
This example clears the outline for the range A1:G37 on Sheet1.
clear outline range "A1:G37" of sheet "Sheet1"
Command: clear range
Clears the entire range object.
Syntax
clear range range Required. An expression that returns a range object.
Example
This example clears the formulas and formatting in cells A1:G37 on Sheet1.
clear range range "A1:G37" of sheet "Sheet1"
Command: clear range formats
Clears the formatting of the specified range.
Syntax
clear range formats range Required. An expression that returns a range object.
Example
This example clears all formatting from cells A1:G37 on Sheet1.
clear range formats range "A1:G37" of sheet "Sheet1"
Command: column differences
Returns a range object that represents all the cells whose contents are different from the comparison
cell in each column.
Syntax
column differences range Required. An expression that returns a range object containing the cells
to compare.
comparison range Required. A single cell to compare to the specified range. Can be a range
object, an A1-style range reference, a named range, or a list of category names.
Table Suite
349
Example
This example selects the cells in column A on Sheet1 whose contents are different from cell A4.
set r1 to column differences range "A:A" comparison range "A4"
select r1
Command: consolidate
Consolidates data from multiple ranges on multiple worksheets into a single range on a single
worksheet.
Syntax
consolidate range Required. An expression that returns a range object.
[sources list] Optional. The sources of the consolidation as a list of text reference strings in
R1C1-style notation. The references must include the full path of sheets to be consolidated.
[consolidation function enumeration] Optional. The consolidation function. The default value is do
average. Can be one of the following:
do average
do count
do count numbers
do maximum
do minimum
do product
do standard deviation
do standard deviation p
do sum
do var
do var p
[top row Boolean] Optional. True to consolidate data based on column titles in the top row of
the consolidation ranges. False to consolidate data by position. The default value is false.
[left column Boolean] Optional. True to consolidate data based on row titles in the left column of the
consolidation ranges. False to consolidate data by position. The default value is false.
[create links Boolean] Optional. True to have the consolidation use worksheet links. False to have the
consolidation copy the data. The default value is false.
Example
This example consolidates data from Sheet2 and Sheet3 onto Sheet1 using the SUM function.
consolidate (range "A1" of worksheet "Sheet1") sources {"Sheet2!R1C1:R37C6", ¬
"Sheet3!R1C1:R37C6"} consolidation function do sum
Table Suite
350
Command: copy picture (table)
Copies the selected object to the Clipboard as a picture.
Syntax
copy picture range Required. An expression that returns a range object.
[appearance enumeration] Optional. Specifies how the picture should be copied. Can be screen
or printer. If screen is used, the picture is copied to resemble its display on the screen as
closely as possible. If printer is used, the picture is copied as it will look when it's printed. The
default value is screen.
[format enumeration] Optional. The format of the picture. Can be picture or bitmap. The default value is
picture.
Remarks
If you copy a range, it must be made up of adjacent cells.
Example
This example copies a screen image of cells A1:D4 on Sheet1 to the Clipboard, and then it pastes the
bitmap to another location on Sheet1.
copy picture range "A1:D4" appearance screen format bitmap
Command: copy range
Copies the range to the specified range or to the Clipboard.
Syntax
copy range range Required. An expression that returns a range object.
[destination range] Optional. Specifies the new range to which the specified range will be
copied. If this argument is omitted, Excel copies the range to the Clipboard.
Example
This example copies the formulas in cells A1:D4 on Sheet1 into cells E5:H8 on Sheet2.
set sourceRange to range "A1:D4" of sheet 1
set destRange to range "E5" of sheet 2
copy range sourceRange destination destRange
Table Suite
351
Command: create names
Creates names in the specified range based on text labels in the sheet.
Syntax
create names range Required. An expression that returns a range object.
[top Boolean] Optional. True to create names by using labels in the top row. The default value is
false.
[left position Boolean] Optional. True to create names by using labels in the left column. The default value
is false.
[bottom Boolean] Optional. True to create names by using labels in the bottom row. The default value is
false.
[right Boolean] Optional. True to create names by using labels in the right column. The default value is
false.
Remarks
If you don't specify either top, left position, bottom, or right, Excel guesses the location of the text
labels based on the shape of the specified range.
Example
This example creates names for cells B1:B3 based on the text in cells A1:A3. Note that you must
include the cells that contain the names in the range, even though the names are created only for
cells B1:B3.
set rangeToName to range "A1:B3" of worksheet "Sheet1"
create names rangeToName with left position
Command: cut range
Cuts the range object to the Clipboard or pastes it into a specified destination.
Syntax
cut range range Required. An expression that returns a range object.
[destination of cut range] Optional. The range where the object should be pasted. Can be a
range object, an A1-style range reference, a named range, or a list of category names. If this
argument is omitted, the object is cut to the Clipboard.
Remarks
The cut range must be made up of adjacent cells.
Example
This example cuts the range A1:G37 on Sheet1 and places it on the Clipboard.
cut range range "A1:G37" of sheet "Sheet1"
Table Suite
352
Command: data series
Creates a data series in the specified range.
Syntax
data series range Required. An expression that returns a range object.
[rowcol enumeration] Optional. Can be by rows or by columns to have the data series entered
in rows or columns, respectively. If this argument is omitted, the size and shape of the range is
used.
[data series type enumeration] Optional. Can be one of the following: autofill series, chronological series,
growth series, or data series linear.
[date enumeration] Optional. If the data series type argument is chronological series, the date argument
indicates the step date unit. The default value is series date day. Can be one of the following: series date
day, series date month, series date weekday, or series date year.
[increment integer] Optional. The step value for the series. The default value is 1.
[stop integer] Optional. The stop value for the series. If this argument is omitted, Excel fills to the end of the
range.
[trend Boolean] Optional. True to create a linear trend or growth trend. False to create a standard data
series. The default value is false.
Example
This example creates a series of 12 dates. The series contains the last day of every month in 1996 and
is created in the range A1:A12 on Sheet1.
set dateRange to range "A1:A12" of worksheet "Sheet1"
set formula of range "A1" of worksheet "Sheet1" to "31-JAN-1996"
data series dateRange data series type chronological series ¬
date series date month
Command: data table
Creates a data table based on input values and formulas that you define on a worksheet.
Syntax
data table range Required. An expression that returns a range object.
[row input cell] Optional. A single cell to use as the row input for your table.
[column input cell] Optional. A single cell to use as the column input for your table.
Remarks
Use data tables to perform a what-if analysis by changing certain constant values on your worksheet
to see how values in other cells are affected.
Table Suite
353
Example
This example creates a formatted multiplication table in cells A1:K11 on Sheet1.
set dtRange to range "A1:K11"
set rowInputCell to cell "A12"
set colInputCell to cell "A13"
set formula of range "A1" to "=A12*A13"
set value of range "B1" to 1
autofill range "B1" destination "B1:K1" type fill series
set value of range "A2" to 1
autofill range "A2" destination "A2:A11" type fill series
data table dtRange row input rowInputCell column input colInputCell
Command: delete range
Deletes the range object.
Syntax
delete range range Required. An expression that returns a range object.
[shift enumeration] Optional. Used only with range objects. Specifies how to shift cells to
replace deleted cells. Can be shift to left or shift up. If this argument is omitted, Excel decides
based on the shape of the range.
Example
This example deletes cells A1:D10 on Sheet1 and shifts the remaining cells to the left.
delete range range "A1:D10" shift shift to left
Command: fill down
Fills down from the top cell or cells in the specified range to the bottom of the range. The contents
and formatting of the cell or cells in the top row of a range are copied into the rest of the rows in the
range.
Syntax
fill down range Required. An expression that returns a range object.
Example
This example fills the range A1:A10 on Sheet1, based on the contents of cell A1.
fill down range "A1:A10" of sheet "Sheet1"
Table Suite
354
Command: fill left
Fills left from the rightmost cell or cells in the specified range. The contents and formatting of the
cell or cells in the rightmost column of a range are copied into the rest of the columns in the range.
Syntax
fill left range Required. An expression that returns a range object.
Example
This example fills the range A1:M1 on Sheet1, based on the contents of cell M1.
fill left range "A1:M1" of sheet "Sheet1"
Command: fill right
Fills right from the leftmost cell or cells in the specified range. The contents and formatting of the
cell or cells in the leftmost column of a range are copied into the rest of the columns in the range.
Syntax
fill right range Required. An expression that returns a range object.
Example
This example fills the range A1:M1 on Sheet1, based on the contents of cell A1.
fill right range "A1:M1" of sheet "Sheet1"
Command: fill up
Fills up from the bottom cell or cells in the specified range to the top of the range. The contents and
formatting of the cell or cells in the bottom row of a range are copied into the rest of the rows in the
range.
Syntax
fill up range Required. An expression that returns a range object.
Example
This example fills the range A1:A10 on Sheet1, based on the contents of cell A10.
fill up range "A1:A10" of sheet "Sheet1"
Table Suite
355
Command: find
Finds specific information in a range, and returns a range object that represents the first cell where
that information is found. Returns an error if no match is found. Doesn't affect the selection or the
active cell.
Syntax
find range Required. An expression that returns a range object.
what Unicode text Required. The data to search for. Can be a string or any Excel data type.
[after range] Optional. The cell after which you want to search. Can be a range object, an A1-style range
reference, a named range, or a list of category names. This corresponds to the position of the active cell
when a search is done from the user interface. Note that after must be a single cell in the range.
Remember that the search begins after this cell; the specified cell isn't searched until the command wraps
back around to this cell. If this argument isn't specified, the search starts after the cell in the upper-left
corner of the range.
[look in enumeration] Optional. Specifies where the find command should look. Can be formulas, values,
or comments.
[look at enumeration] Optional. Specifies the part that should be looked at. Can be whole or part.
[search order enumeration] Optional. Specifies whether the search should be done by rows or by columns.
Can be by rows or by columns.
[search direction enumeration] Optional. Specifies the search direction, either next or previous. Can be
search next or search previous. The default value is search next.
[match case Boolean] Optional. True to make the search case sensitive.
[match byte Boolean] Optional. Used only in the Japanese version of Excel. True to have double-byte
characters match only double-byte characters. False to have double-byte characters match their single-
byte equivalents.
Remarks
The settings for look in, look at, search order, match case, and match byte are saved each time you
use this command. If you don't specify values for these arguments the next time you call the
command, the saved values are used. Setting these arguments changes the settings in the Find
dialog box, and changing the settings in the Find dialog box changes the saved values that are used
if you omit the arguments. To avoid problems, set these arguments explicitly each time you use this
command.
The find next and find previous commands can be used to repeat the search.
When the search reaches the end of the specified search range, it wraps around to the beginning of
the range. To stop a search when this wraparound occurs, save the address of the first found cell,
and then test each successive found-cell address against this saved address.
Table Suite
356
To find cells that match more complicated patterns, use a nested loop. For example, the following
code searches for all cells in the range A1:E5 that use a font whose name starts with the letters
"Cour". When Excel finds a match, it changes the font to Times New Roman.
repeat with theRow from 1 to 5
repeat with theCol in {"A", "B", "C", "D", "E"}
if name of font object of cell (theCol & theRow) contains "Cour" then
set name of font object of cell (theCol & theRow) to "Times New Roman"
end if
end repeat
end repeat
Example
This example shows how the find command is used with the find next and find previous
commands. Before running this example, make sure that Sheet1 contains at least two occurrences of
the word "Phoenix" in column B.
set fc to (find (range "B:B" of worksheet "Sheet1") what "Phoenix")
display dialog "The first occurrence is in cell " & (get address fc)
set fc to (find next (range "B:B" of worksheet "Sheet1") after fc)
display dialog "The next occurrence is in cell " & (get address fc)
set fc to (find previous (range "B:B" of worksheet "Sheet1") after fc)
display dialog "The previous occurrence is in cell " & (get address fc)
Command: find next
Continues a search that was begun with the find command. Finds the next cell that matches those
same conditions and returns a range object that represents that cell. Doesn't affect the selection or
the active cell.
Syntax
find next range Required. An expression that returns a range object.
[after range] Optional. The cell after which you want to search. Can be a range object, an A1-
style range reference, a named range, or a list of category names. This corresponds to the
position of the active cell when a search is done from the user interface. Note that after must
be a single cell in the range. Remember that the search begins after this cell; the specified cell
isn't searched until the command wraps back around to this cell. If this argument isn't
specified, the search starts after the cell in the upper-left corner of the range.
Remarks
When the search reaches the end of the specified search range, it wraps around to the beginning of
the range. To stop a search when this wraparound occurs, save the address of the first found cell,
and then test each successive found-cell address against this saved address.
Table Suite
357
Example
This example shows how the find next command is used with the find and find previous
commands. Before running this example, make sure that Sheet1 contains at least two occurrences of
the word "Phoenix" in column B.
set fc to (find (range "B:B" of worksheet "Sheet1") what "Phoenix")
display dialog "The first occurrence is in cell " & (get address fc)
set fc to (find next (range "B:B" of worksheet "Sheet1") after fc)
display dialog "The next occurrence is in cell " & (get address fc)
set fc to (find previous (range "B:B" of worksheet "Sheet1") after fc)
display dialog "The previous occurrence is in cell " & (get address fc)
Command: find previous
Continues a search that was begun with the find command. Finds the previous cell that matches
those same conditions and returns a range object that represents that cell. Doesn't affect the selection
or the active cell.
Syntax
find previous range Required. An expression that returns a range object.
[after range] Optional. The cell after which you want to search. Can be a range object, an A1-
style range reference, a named range, or a list of category names. This corresponds to the
position of the active cell when a search is done from the user interface. Note that after must
be a single cell in the range. Remember that the search begins after this cell; the specified cell
isn't searched until the command wraps back around to this cell. If this argument isn't
specified, the search starts after the cell in the upper-left corner of the range.
Remarks
When the search reaches the beginning of the specified search range, it wraps around to the end of
the range. To stop a search when this wraparound occurs, save the address of the first found cell,
and then test each successive found-cell address against this saved address.
Example
This example shows how the find previous command is used with the find and find next
commands. Before running this example, make sure that Sheet1 contains at least two occurrences of
the word "Phoenix" in column B.
set fc to (find (range "B:B" of worksheet "Sheet1") what "Phoenix")
display dialog "The first occurrence is in cell " & (get address fc)
set fc to (find next (range "B:B" of worksheet "Sheet1") after fc)
display dialog "The next occurrence is in cell " & (get address fc)
set fc to (find previous (range "B:B" of worksheet "Sheet1") after fc)
display dialog "The previous occurrence is in cell " & (get address fc)
Table Suite
358
Command: function wizard
Starts the Function Wizard for the upper-left cell of the range.
Syntax
function wizard range Required. An expression that returns a range object.
Example
This example starts the Function Wizard for the cell A1 on Sheet1.
function wizard cell "A1" of sheet "Sheet1"
Command: get address
Returns the range reference.
Syntax
get address range Required. An expression that returns a range object.
[row absolute Boolean] Optional. Set to true to return the row part of the reference as an
absolute reference. The default value is true.
[column absolute Boolean] Optional. Set to true to return the column part of the reference as an absolute
reference. The default value is true.
[reference style enumeration] Optional. Specifies what reference style should be returned. Can be A1 or
R1C1. The default value is A1.
[external Boolean] Optional. Set to true to return an external reference, false to return a local reference. The
default value is false.
[relative to range] Optional. If row absolute and column absolute are false, and reference style is R1C1,
you must include a starting point for the relative reference. This argument is a range object that defines
the starting point. Can be a range object, an A1-style range reference, a named range, or a list of category
names.
Example
This example looks for the string "bananas" and if found, returns the range reference. Before
running this example, make sure that Sheet1 contains at least one occurrence of the word "bananas"
in the range A1:A4.
set fdRange to find range "A1:A4" what "bananas"
display dialog "Found bananas in cell " & (get address fdRange)
Table Suite
359
Command: get address local
Returns the range reference in the language of the user.
Syntax
get address local range Required. An expression that returns a range object.
[row absolute Boolean] Optional. Set to true to return the row part of the reference as an
absolute reference. The default value is true.
[column absolute Boolean] Optional. Set to true to return the column part of the reference as an absolute
reference. The default value is true.
[reference style enumeration] Optional. Specifies what reference style should be returned. Can be A1 or
R1C1. The default value is A1.
[external Boolean] Optional. Set to true to return an external reference, false to return a local reference. The
default value is false.
[relative to range] Optional. If row absolute and column absolute are false, and reference style is R1C1,
you must include a starting point for the relative reference. This argument is a range object that defines
the starting point. Can be a range object, an A1-style range reference, a named range, or a list of category
names.
Example
This example looks for the string "bananas" and if found, returns the range reference. Before
running this example, make sure that Sheet1 contains at least one occurrence of the word "bananas"
in the range A1:A4.
set fdRange to find range "A1:A4" what "bananas"
display dialog "Found bananas in cell " & (get address local fdRange)
Command: get border (table)
Returns the specified border object.
get border range Required. An expression that returns a border object.
which border enumeration Required. The border to be retrieved. Can be one of the following:
inside horizontal
inside vertical
diagonal down
diagonal up
edge bottom
edge left
edge right
edge top
border bottom
border left
border right
border top
Table Suite
360
Example
This example adds a solid border around the range A1:B5.
set line style of (get border range "A1:B5" which border border top) ¬
to continuous
set line style of (get border range "A1:B5" which border border bottom) ¬
to continuous
set line style of (get border range "A1:B5" which border border left) ¬
to continuous
set line style of (get border range "A1:B5" which border border right) ¬
to continuous
Command: get end
Returns a range object that represents the cell at the end of the region that contains the source range.
Syntax
get end range Required. An expression that returns a range object.
direction enumeration Required. The direction in which to move. Can be one of the following:
toward the bottom, toward the left, toward the right, or toward the top.
Example
This example finds the cell furthest to the right of the cell C2 in the range containing C2. Before
running this example, make sure that Sheet1 contains data in every cell in the range A1:E5. The
example should return E2.
set theEnd to get end range "C2" direction toward the right
Command: get offset
Returns a range object that represents a range that's offset from the specified range.
Syntax
get offset range Required. An expression that returns a range object.
[row offset integer] Optional. The number of rows — positive, negative, or zero — by which the
range is to be offset. The default value is 0.
[column offset integer] Optional. The number of columns — positive, negative, or zero — by which the
range is to be offset. The default value is 0.
Example
This example gets the range object for a range that is offset of range A3:E5 by 3 rows and 4 columns.
The example should return a reference for range E6:I8.
get offset range "A3:E5" row offset 3 column offset 4
Table Suite
361
Command: get resize
Resizes the specified range. Returns a range object that represents the resized range.
Syntax
get resize range Required. An expression that returns a range object.
[row size integer] Optional. The number of rows in the new range. If this argument is omitted,
the number of rows in the range remains the same.
[column size integer] Optional. The number of columns in the new range. If this argument is omitted, the
number of columns in the range remains the same.
Example
This example changes the size of the range A3:E5 to a range 7 rows down by 4 columns across, with
A3 as the top left cell. The example should return a reference for the range A3:D9.
get resize range "A3:E5" row size 7 column size 4
Command: get XML value
Returns the value of the specified range as XML.
Syntax
get XML value range Required. An expression that returns a range object.
Example
This example gets the value of the range A1:C3 as XML.
get XML value range "A1:C3"
Command: goal seek
Calculates the values necessary to achieve a specific goal. If the goal is an amount returned by a
formula, this calculates a value that, when supplied to your formula, causes the formula to return
the number you want. Returns true if the goal seek is successful.
Syntax
goal seek range Required. An expression that returns a range object. Must be a single cell.
goal real Required. The value you want returned in this cell.
changing cell range Required. Specifies which cell should be changed to achieve the target value.
Table Suite
362
Example
This example assumes that Sheet1 has a cell named "Polynomial" that contains the formula
=(X^3)+(3*X^2)+6 and another cell named "X" that's empty. The example finds a value for X so that
Polynomial contains the value 15.
goal seek (range "Polynomial" of worksheet "Sheet1") goal 15 ¬
changing cell (range "X" of worksheet "Sheet1")
Command: group
When the range object represents a single cell in the pivot field's data range, the group command
performs numeric or date-based grouping in a pivot field.
Syntax
group range Required. An expression that returns a range object. The range object must be a
single cell in the pivot field's data range. If you attempt to apply this command to more than one
cell, it will fail (without displaying an error message).
[start integer] Optional. The first value to be grouped. If this argument is omitted or true, the
first value in the field is used.
[end integer] Optional. The last value to be grouped. If this argument is omitted or true, the last value in
the field is used.
[by integer] Optional. If the field is numeric, this argument specifies the size of each group.
If the field is a date, this argument specifies the number of days in each group if element 4 in
the periods list is true and all the other elements are false. Otherwise, this argument is
ignored.
If this argument is omitted, Excel automatically chooses a default group size.
[periods list] Optional. A list of Boolean values that specify the period for the group, as shown
in the following table.
Element Period
1 Seconds
2 Minutes
3 Hours
4 Days
5 Months
6 Quarters
7 Years
If an element in the list is true, a group is created for the corresponding time; if the element is
false, no group is created. If the field isn't a date field, this argument is ignored.
Table Suite
363
Example
This example groups the field named "ORDER_DATE" by 10-day periods.
set pvtTable to pivot table of range "A3" of worksheet "Sheet1"
set groupRange to data range of pivot field "ORDER_DATE" of pvtTable
group (cell 1 of groupRange) by 10 periods {false, false, false, true, false, ¬
false, false}
Command: insert indent
Adds an indent to the specified range.
Syntax
insert indent range Required. An expression that returns a range object.
insert amount integer Required. The amount to be added to the current indent.
Remarks
Using this command to set the indent level to a number less than 0 (zero) or greater than 15 causes
an error.
To return the indent level for a range, use the indent level property of the range object.
Example
This example decreases the indent level in cell A10.
insert indent range "A10" insert amount -1
Command: insert into range
Inserts a cell or a range of cells into the worksheet or macro sheet and shifts other cells away to
make space.
Syntax
insert into range range Required. An expression that returns a range object.
[shift enumeration] Optional. Specifies which way to shift the cells. Can be one of the following:
shift down or shift to right. If this argument is omitted, Excel decides based on the shape of
the range.
Example
This example inserts a new row before row four on Sheet1.
insert into range row 4 of sheet "Sheet1"
This example inserts new cells at the range A1:C5 on Sheet1 and shifts cells downward.
insert into range range "A1:C5" of sheet "Sheet1" shift shift down
Table Suite
364
Command: justify
Rearranges the text in a range so that it fills the range evenly.
Syntax
justify range Required. An expression that returns a range object.
Remarks
If the range isn't large enough, Excel displays a message telling you that text will extend below the
range. If you click the OK button, justified text will replace the contents in cells that extend beyond
the selected range. To prevent this message from appearing, set the display alerts property of the
application object to false. After you set this property, text will always replace the contents in cells
below the range.
Example
This example justifies the text in cell A1 on Sheet1. Before you run this example, make sure you
have text in cell A1.
justify range "A1" of sheet "Sheet1"
Command: list names
Pastes a list of all non-hidden names onto the worksheet, beginning with the first cell in the range.
Syntax
list names range Required. An expression that returns a range object.
Example
This example pastes a list of defined names into cell A1 on Sheet1. The example pastes both
workbook-level names and sheet-level names defined on Sheet1.
list names range "A1" of sheet "Sheet1"
Command: merge
Creates a merged cell from the specified range object.
Syntax
merge range Required. An expression that returns a range object.
[across Boolean] Optional. True to merge cells in each row in the specified range as separate
merged cells. The default value is false.
Remarks
The value of a merged range is the value specified for the cell in the upper-left corner of the merged
range.
Table Suite
365
Example
This example merges all of the cells in range A1:C10 into cell A1.
merge range "A1:C10"
Command: navigate arrow
Navigates a tracer arrow for the specified range to the precedent, dependent, or error-causing cell or
cells. Selects the precedent, dependent, or error cells and returns a range object that represents the
new selection. This command causes an error if it's applied to a cell without visible tracer arrows.
Syntax
navigate arrow range Required. An expression that returns a range object.
[toward precedent Boolean] Optional. Specifies the direction to navigate: true to navigate
toward precedents, false to navigate toward dependents.
[arrow number integer] Optional. Specifies the arrow number to navigate; corresponds to the numbered
reference in the cell's formula.
[link number integer] Optional. If the arrow is an external reference arrow, this argument indicates which
external reference to follow. If this argument is omitted, the first external reference is followed.
Example
This example navigates along the first tracer arrow from cell A1 on Sheet1 toward the precedent
cell. The example should be run on a worksheet containing a formula in cell A1 that includes
references to cells D1, D2, and D3 (for example, the formula =D1*D2*D3). Before running the
example, display the Auditing toolbar, select cell A1, and click the Trace Precedents button.
activate object worksheet "Sheet1"
select range "A1"
navigate arrow active cell arrow number 1 with toward precedent
Command: parse
Parses a range of data and breaks it into multiple cells. Distributes the contents of the range to fill
several adjacent columns; the range can be no more than one column wide.
Syntax
parse range Required. An expression that returns a range object.
[parse line Unicode text] Optional. A string that contains left and right brackets to indicate
where the cells should be split. For example, "[xxx][xxx]" would insert the first three
characters into the first column of the destination range, and it would insert the next three
characters into the second column. If this argument is omitted, Excel guesses where to split the
columns based on the spacing of the top left cell in the range. If you want to use a different
range to guess the parse line, use a range object as the parse line argument. That range must
be one of the cells that's being parsed. The parse line argument cannot be longer than 255
characters, including the brackets and spaces.
Table Suite
366
[destination range] Optional. A range object that represents the upper-left corner of the destination range
for the parsed data. If this argument is omitted, Excel parses in place. Can be a range object, an A1-style
range reference, a named range, or a list of category names.
Example
This example divides telephone numbers of the form 206-555-1212 into two columns. The first
column contains only the area code, and the second column contains the seven-digit telephone
number with the embedded hyphen.
parse (range "A:A" of worksheet "Sheet1") parse line "[XXX] [XXXXXXX]" ¬
destination (range "B1" of worksheet "Sheet1")
Command: paste special
Pastes a range from the Clipboard into the specified range.
Syntax
paste special range Required. An expression that returns a range object.
[what enumeration] Optional. The part of the range to be pasted. The default value is paste all.
Can be one of the following:
paste all
paste all except borders
paste formats
paste formulas
paste comments
paste values
paste column widths
paste validation
paste formulas and number formats
paste values and number formats
[operation enumeration] Optional. The paste operation. Can be one of the following:
paste special operation add
paste special operation subtract
paste special operation multiply
paste special operation divide
paste special operation none
[skip blanks Boolean] Optional. True to have blank cells in the range on the Clipboard not be
pasted into the destination range.
[transpose Boolean] Optional. True to transpose rows and columns when the range is pasted. The default
value is false.
Example
This example replaces the data in cells D1:D5 on Sheet1 with the sum of the existing contents and
cells C1:C5 on Sheet1.
copy range range "C1:C5"
paste special range "D1:D5" operation paste special operation add
Table Suite
367
Command: print out (table)
Prints the object.
Syntax
print out range Required. An expression that returns a range object.
[from integer] Optional. The number of the page at which to start printing. If this argument is
omitted, printing starts at the beginning.
[to integer] Optional. The number of the last page to print. If this argument is omitted, printing ends with
the last page.
[copies integer] Optional. The number of copies to print. If this argument is omitted, one copy is printed.
[preview Boolean] Optional. True to have Excel invoke print preview before printing the object. False (or
omitted) to print the object immediately.
[active printer Unicode text] Optional. This argument is not currently supported.
[print to file Boolean] Optional. This argument is not currently supported.
[collate Boolean] Optional. True to collate multiple copies.
Remarks
"Pages" in the descriptions of from and to refers to printed pages, not overall pages in the sheet or
workbook.
This command applies to the window object only when it's the Info window.
Example
This example prints the active sheet.
print out active sheet
Command: print preview (table)
Shows a preview of the object as it would look when printed.
Syntax
print preview range Required. An expression that returns a range object.
[enable changes Boolean] Optional. Controls access to the Page Setup dialog box and the ability
to change margins from the Preview window by enabling or disabling the Setup and Margins
buttons, respectively.
Example
This example displays Sheet1 in print preview.
print preview sheet "Sheet1"
Table Suite
368
Command: remove subtotal
Removes subtotals from a list.
Syntax
remove subtotal range Required. An expression that returns a range object.
Example
This example removes subtotals from the range A1:G37 on Sheet1. The example should be run on a
list that has subtotals.
remove subtotal range "A1:G37" of sheet "Sheet1"
Command: replace
Finds and replaces characters in cells within a range. Doesn't change the selection or the active cell.
Syntax
replace range Required. An expression that returns a range object.
what Unicode text Required. The string to search for.
replacement Unicode text Required. The replacement string.
[look at enumeration] Optional. Specifies the part that should be looked at. Can be whole or part.
[search order enumeration] Optional. Specifies whether the search should be rows or columns. Can be by
rows or by columns.
[match case Boolean] Optional. True to make the search case sensitive.
[match byte Boolean] Optional. Used only in the Japanese versions of Excel. True to have double-byte
characters match only double-byte characters. False to have double-byte characters match their single-
byte equivalents.
[match control characters Boolean] Optional. Used only in the Japanese version of Excel. True to have
double-byte characters match only double-byte characters. False to have double-byte characters match
their single -byte equivalents.
[match diacritics Boolean] Optional. Used only in the Japanese version of Excel. True to have double-byte
characters match only double-byte characters. False to have double-byte characters match their single-
byte equivalents.
Remarks
The settings for look at, search order, match case, and match byte are saved each time you use this
command. If you don't specify values for these arguments the next time you call the command, the
saved values are used. Setting these arguments changes the settings in the Find dialog box, and
changing the settings in the Find dialog box changes the saved values that are used if you omit the
arguments. To avoid problems, set these arguments explicitly each time you use this command.
If the contents of the what argument are found in at least one cell on the sheet, this command
returns true.
Table Suite
369
Example
This example replaces every occurrence of the function SIN with the function COS. The replacement
range is column A on Sheet1.
replace (range "A:A" of worksheet "Sheet1") what "SIN" replacement "COS" ¬
search order by columns with match case
Command: row differences
Returns a range object that represents all the cells whose contents are different from those of the
comparison cell in each row.
Syntax
row differences range Required. An expression that returns a range containing the cells to be
compared.
comparison cell Required. A single cell to compare with the specified range.
Example
This example selects the cells in row one on Sheet1 whose contents are different from those of
cell D1.
set c1 to row differences range "1:1" comparison range "D1"
select c1
Command: run VB macro (table)
Runs the Excel 4.0 (XLM) macro at this location. The range must be on a macro sheet.
Syntax
run VB macro range Required. An expression that returns a range on a macro sheet that contains
an Excel 4.0 (XLM) macro.
[arg1, arg2, ... anything] Optional. The arguments that should be passed to the function.
Remarks
You cannot use named arguments with this command. Arguments must be passed by position.
The run VB macro command returns whatever the called macro returns. Objects passed as
arguments to the macro are converted to values (by applying the value property to the range object).
This means that you cannot pass objects to macros by using the run VB macro command.
Example
This example shows how to call the function macro My_Func_Sum, which is defined on the macro
sheet Mycustom.xlm (the macro sheet must be open). The function takes two numeric arguments
(1 and 5, in this example).
set mySum to (run VB macro (range "MYCUSTOM.XLM!My_Func_Sum") arg1 1 arg2 5)
display dialog "Macro result: " & mySum
Table Suite
370
Command: set XML value
Sets the value of the specified range as XML.
Syntax
set XML value range Required. An expression that returns a range object.
range value anything Required. The value of the range.
Example
This example sets the value of the range A1:C3 as XML.
set XML value range "A1:C3" range value "test"
Command: show (table)
Scrolls through the contents of the active window to move the range into view.
Syntax
show range Required. An expression that returns a range object.
Example
This example scrolls through the contents of the active window to show cell M1.
show range "M1"
Command: show dependents
Draws tracer arrows to the direct dependents of the range.
Syntax
show dependents range Required. An expression that returns a range object. Must be a single
cell.
[remove Boolean] Optional. True to remove one level of tracer arrows to direct dependents.
False to expand one level of tracer arrows. The default value is false.
Example
This example draws tracer arrows to dependents of cell D7 on Sheet1.
show dependents range "D7"
This example removes the tracer arrow for one level of dependents of cell D7 on Sheet1.
show dependents range "D7" remove true
Table Suite
371
Command: show errors
Draws tracer arrows through the precedents tree to the cell that's the source of the error, and returns
the range that contains that cell.
Syntax
show errors range Required. An expression that returns a range object.
Example
This example displays a red tracer arrow if there's an error in the active cell on Sheet1.
activate object worksheet "Sheet1"
show errors active cell
Command: show precedents
Draws tracer arrows to the direct precedents of the range.
Syntax
show precedents range Required. An expression that returns a range object. Must be a single cell.
[remove Boolean] Optional. True to remove one level of tracer arrows to direct precedents.
False to expand one level of tracer arrows. The default value is false.
Example
This example draws tracer arrows to the precedents of cell D7 on Sheet1.
show precedents range "D7"
This example removes the tracer arrow for one level of precedents of the active cell on Sheet1.
show precedents active cell remove true
Command: sort
Sorts a PivotTable report, a range, or the current region (if the specified range contains only one
cell).
Syntax
sort range Required. An expression that returns a range object.
[key1 range] Optional. The first sort field, as either text (a pivot field or range name) or a range
object ("Dept" or
cells "1,1", for example).
[order1 enumeration] Optional. Can be sort ascending, sort descending, or sort manual. Use sort
ascending to sort key1 in ascending order. Use sort descending to sort key1 in descending order. The
default value is sort ascending.
Table Suite
372
[key2 range] Optional. The second sort field, as either text (a pivot field or range name) or a range object. If
this argument is omitted, there's no second sort field. Not used when sorting PivotTable reports.
[order2 enumeration] Optional. Can be sort ascending, sort descending, or sort manual. Use sort
ascending to sort key2 in ascending order. Use sort descending to sort key2 in descending order. The
default value is sort ascending. Not used when sorting PivotTable reports.
[key3 range] Optional. The third sort field, as either text (a range name) or a range object. If this argument
is omitted, there's no third sort field. Not used when sorting PivotTable reports.
[order3 enumeration] Optional. Can be sort ascending, sort descending, or sort manual. Use sort
ascending to sort key3 in ascending order. Use sort descending to sort key3 in descending order. The
default value is sort ascending. Not used when sorting PivotTable reports.
[header enumeration] Optional. Specifies whether the first row contains headers. Can be one of the
following: header yes, header no, or header guess. Use header yes if the first row contains headers (it
shouldn't be sorted). Use header no if there are no headers (the entire range should be sorted). Use
header guess to let Excel determine whether there's a header, and to determine where it is, if there is one.
The default value is header no. Not used when sorting PivotTable reports.
[order custom integer] Optional. A 1-based integer offset into the list of custom sort orders. If this
argument is omitted, 1 (Normal) is used.
[match case Boolean] Optional. True to do a case-sensitive sort; false to do a sort that's not case sensitive.
Not used when sorting PivotTable reports.
[orientation enumeration] Optional. Specifies whether the sort is done top to bottom or bottom to top. Can
be sort rows or
sort columns. If sort rows is used, the sort is done from top to bottom (by row). If sort
columns is used, the sort is done from left to right (by column).
[sort method enumeration] Optional. The type of sort. Can be stroke (to sort phonetically) or pin yin (to
sort by code page). The default value is stroke. This argument works only in the Japanese version of
Excel or in an English version of Excel that you have registered as Japanese by using the Microsoft
Language Register application.
[ignore control characters Boolean] Optional. This argument is currently not supported.
[ignore diacritics Boolean] Optional. This argument is currently not supported.
Example
This example sorts the range A1:C20 on Sheet1, using cell A1 as the first sort key and cell B1 as the
second sort key. The sort is done in ascending order by row, and there are no headers.
sort range "A1:C20" of worksheet "Sheet1" key1 (range "A1" of ¬
worksheet "Sheet1") key2 (range "B1"of worksheet "Sheet1")
This example sorts the current region that contains cell A1 on Sheet1, sorting by the data in the first
column and automatically using a header row if one exists. The sort command determines the
current region automatically.
sort range "A1" of worksheet "Sheet1" key1 (range "A:A" of worksheet "Sheet1") ¬
header header guess
Table Suite
373
Command: sort special
Uses Japanese sorting techniques to sort the range, or uses the current region if the range contains
only one cell.
Syntax
sort special range Required. An expression that returns a range object.
[sort method enumeration] Optional. Specifies how to sort. Can be stroke (to sort phonetically)
or pin yin (to sort by code page). The default value is stroke. This argument works only in the
Japanese version of Excel or in an English version of Excel that you have registered as Japanese
by using the Microsoft Language Register application.
[key1 range] Optional. The first sort field, as either text (a pivot field or range name) or a range object
("Dept" or cells "1,1", for example).
[order1 enumeration] Optional. Can be sort ascending, sort descending, or sort manual. Use sort
ascending to sort key1 in ascending order. Use sort descending to sort key1 in descending order. The
default value is sort ascending.
[type enumeration] Optional. Specifies which elements are sorted. Can be sort values or sort labels. Used
only when sorting PivotTable reports.
[key2 range] Optional. The second sort field, as either text (a pivot field or range name) or a range object. If
this argument is omitted, there's no second sort field. Not used when sorting PivotTable reports.
[order2 enumeration] Optional. Can be sort ascending, sort descending, or sort manual. Use sort
ascending to sort key2 in ascending order. Use sort descending to sort key2 in descending order. The
default value is sort ascending. Not used when sorting PivotTable reports.
[key3 range] Optional. The third sort field, as either text (a range name) or a range object. If this argument
is omitted, there's no third sort field. Not used when sorting PivotTable reports.
[order3 enumeration] Optional. Can be sort ascending, sort descending, or sort manual. Use sort
ascending to sort key3 in ascending order. Use sort descending to sort key3 in descending order. The
default value is sort ascending. Not used when sorting PivotTable reports.
[header enumeration] Optional. Specifies whether the first row contains headers. Can be one of the
following: header yes
, header no, or header guess. Use header yes if the first row contains headers (it
shouldn't be sorted). Use header no if there are no headers (the entire range should be sorted). Use
header guess to let Excel determine whether there's a header, and to determine where it is, if there is one.
The default value is header no. Not used when sorting PivotTable reports.
[order custom integer] Optional. A 1-based integer offset into the list of custom sort orders. If this
argument is omitted, 1 (Normal) is used.
[match case Boolean] Optional. True to do a case-sensitive sort; false to do a sort that's not case sensitive.
Not used when sorting PivotTable reports.
[orientation enumeration] Optional. Specifies whether the sort is done top to bottom or bottom to top. Can
be sort rows or sort columns. If sort rows is used, the sort is done from top to bottom (by row). If sort
columns is used, the sort is done from left to right (by column).
Table Suite
374
Example
This example sorts the range A1:G37 on Sheet1, using cell A1 as the first sort key and cell C1 as the
second sort key. The sort is done in ascending order by row, and there are no headers.
sort special range "A1:G37" of worksheet "Sheet1" key1 (range "A1" of ¬
worksheet "Sheet1") order1 sort ascending key2 (range "C1" of ¬
worksheet "Sheet1") order2 sort ascending
Command: special cells
Returns a range object that represents all the cells that match the specified type and value.
Syntax
special cells range Required. An expression that returns a range object.
type enumeration Required. The cells to include. Can be one of the following:
Value Description
cell type all format conditions
All cells containing a format condition
cell type all validation
All cells containing data validation
cell type blanks
Empty cells
cell type comments
Cells containing comments
cell type constants
Cells containing constants
cell type formulas
Cells containing formulas
cell type last cell
The last cell in the used range
cell type same format conditions
Cells containing the same format conditions
cell type same validation
Cells containing the same data validation
cell type visible
All visible cells
[value enumeration] Optional. If type is either cell type constants or cell type formulas, this
argument is used to determine which types of cells to include in the result. These values can be
added together to return more than one type. The default is to select all constants or formulas,
no matter what the type. Can be one of the following: errors, logical, numbers, or text values.
Example
This example selects the last cell in the used range of Sheet1.
activate object worksheet "Sheet1"
activate object (special cells (cells of active sheet) ¬
type cell type last cell)
Table Suite
375
Command: subtotal
Creates subtotals for the range (or the current region, if the range is a single cell).
Syntax
subtotal range Required. An expression that returns a range object.
group by integer Required. The field to group by, as a 1-based integer offset. For more
information, see the example.
function enumeration Required. The subtotal function. Can be one of the following:
do average
do count
do count numbers
do maximum
do minimum
do product
do standard deviation
do standard deviation p
do sum
do var
do var p
total list list Required. A list of 1-based field offsets, indicating the fields to which the subtotals
are added. For more information, see the example.
[replace Boolean] Optional. True to replace existing subtotals. The default value is false.
[page breaks Boolean] Optional. True to add page breaks after each group. The default value is false.
[summary below data enumeration] Optional. Can be summary above or summary below. The default
value is summary below.
Example
This example creates subtotals for the selection on Sheet1. The subtotals are sums grouped by each
change in field one, with the subtotals added to fields two and three.
activate object worksheet "Sheet1"
subtotal selection group by 1 function do sum total list {2, 3}
Command: text to columns
Parses a column of cells that contain text into several columns.
Syntax
text to columns range Required. An expression that returns a range object.
[destination range] Optional. A range object that specifies where Excel will place the results. If
the range is larger than a single cell, the top left cell is used. Can be a range object, an A1-style
range reference, a named range, or a list of category names.
[data type enumeration] Optional. The format of the text to be split into columns. Can be delimited or
fixed width. The default value is delimited.
Table Suite
376
[text qualifier enumeration] Optional. The text qualifier. Can be one of the following: text qualifier
double quote, text qualifier single quote, or text qualifier none. The default value is text qualifier
double quote.
[consecutive delimiter Boolean] Optional. True to have Excel consider consecutive delimiters as one
delimiter. The default value is false.
[tab Boolean] Optional. True to have data type be delimited and to have the tab character be a delimiter.
The default value is false.
[semicolon Boolean] Optional. True to have data type be delimited and to have the semicolon be a
delimiter. The default value is false.
[comma Boolean] Optional. True to have data type be delimited and to have the comma be a delimiter.
The default value is false.
[space Boolean] Optional. True to have data type be delimited and to have the space character be a
delimiter. The default value is false.
[use other Boolean] Optional. True to have data type be delimited and to have the character be specified
by the other char argument be a delimiter. The default value is false.
[other char Unicode text] Optional. (required if use other is true). The delimiter character when use other is
true. If more than one character is specified, only the first character of the string is used; the remaining
characters are ignored.
[field info list] Optional. A list containing parse information for the individual columns of data. The
interpretation depends on the value of
data type.
When the data is delimited, this argument is a list of two-element column specifiers, each
specifying the conversion options for a particular column. The first element is the column
number (1-based), and the second element is one of the following numbers, specifying how the
column is parsed:
1 General
2 Text
3 MDY date
4 DMY date
5 YMD date
6 MYD date
7 DYM date
8 YDM date
9 Skip the column
The column specifiers can be in any order. If a given column specifier is not present for a
particular column in the input data, the column is parsed with the General setting. This
example causes the third column to be skipped, the first column to be parsed as text, and the
remaining columns in the source data to be parsed with the General setting.
{{3, 9}, {1, 2}}
Table Suite
377
If the source data has fixed-width columns, the first element of each column specifier indicates
the starting character position in the column (as an integer; 0 (zero) is the first character). The
second element specifies the parse option for the column as a number from 1 through 9, as
listed above.
The following example parses two columns from a fixed-width file, with the first column
starting at the beginning of the line and extending for 10 characters. The second column starts
at position 15 and goes to the end of the line. To avoid including the characters between
position 10 and position 15, Excel adds a skipped column entry.
{{0, 1}, {10, 9}, {15, 1}}
[decimal separator Unicode text] Optional. A string specifying whether a comma or period is
used in the text file as the separator for decimal numbers.
[thousands separator Unicode text] Optional. A string specifying whether a comma, period, or apostrophe
is used in the text file as the separator for thousands.
Example
This example converts the contents of the Clipboard, which contains a space-delimited text table,
into separate columns on Sheet1. You can create a simple space-delimited table in a text editor, copy
the text table to the Clipboard, switch to Excel, and then run this example.
activate object worksheet "Sheet1"
paste sheet active sheet
text to columns selection data type delimited ¬
with consecutive delimiter and tab
Command: ungroup
Promotes a range in an outline (that is, decreases its outline level). The specified range must be a
row or column, or a range of rows or columns. If the range is in a PivotTable report, this command
ungroups the items contained in the range.
Syntax
ungroup range Required. An expression that returns a range object.
Remarks
If the active cell is in a field header of a parent field, all the groups in that field are ungrouped and
the field is removed from the PivotTable report. When the last group in a parent field is ungrouped,
the entire field is removed from the PivotTable report.
Example
This example ungroups the ORDER_DATE field.
set pvtTable to pivot table of range "A3" of worksheet "Sheet1"
set groupRange to data range of pivot field "ORDER_DATE" of pvtTable
ungroup (cell 1 of groupRange)
Table Suite
378
Command: unmerge
Separates a merged area into individual cells.
Syntax
unmerge range Required. An expression that returns a range object.
Example
This example separates the merged range that contains cell A3.
unmerge range "A3"
Proofing Suite
379
Proofing Suite
Proofing Suite Classes................................................................................................................................................379
Proofing Suite Commands ........................................................................................................................................380
Proofing Suite Classes
autocorrect................................................................................................................................................................... 379
Class: autocorrect
Contains Excel AutoCorrect attributes (capitalization of names of days, correction of two initial
capital letters, automatic correction list, and so on).
Use the autocorrect class to set the attributes of the autocorrect object. The following example sets
Excel to correct words that begin with two initial capital letters.
set two initial capitals of autocorrect object to true
set replace text of autocorrect object to true
Properties
capitalize names of days
True if the first letter of day names is capitalized automatically. Read/write.
correct caps lock
True if Excel automatically corrects accidental use of the CAPS LOCK key. Read/write.
correct sentence cap
True if Excel automatically corrects sentence (first word) capitalization. Read/write.
replace text
True if text in the list of AutoCorrect replacements is replaced automatically. Read/write.
two initial capitals
True if words that begin with two capital letters are corrected automatically. Read/write.
.
Proofing Suite
380
Proofing Suite Commands
add replacement.........................................................................................................................................................380
delete replacement .....................................................................................................................................................380
get replacement list .................................................................................................................................................... 380
Command: add replacement
Adds an entry to the list of AutoCorrect replacements.
Syntax
add replacement autocorrect Required. An expression that returns an autocorrect object.
text to replace Unicode text Required. The text to be replaced. If this string already exists in the
list of AutoCorrect replacements, the existing substitute text is replaced by the new text.
replacement text Unicode text Required. The replacement text.
Example
This example substitutes the word "Temp." for the word "Temperature" in the list of AutoCorrect
replacements.
add replacement autocorrect object text to replace "Temp." ¬
replacement text "Temperature"
Command: delete replacement
Deletes an entry from the list of AutoCorrect replacements.
Syntax
delete replacement autocorrect Required. An expression that returns an autocorrect object.
what Unicode text Required. The text to be replaced, as it appears in the row to be deleted from
the list of AutoCorrect replacements. If this string doesn't exist in the list of AutoCorrect
replacements, this command fails.
Example
This example removes the word "Temp" from the list of AutoCorrect replacements.
delete replacement autocorrect object what "Temp"
Command: get replacement list
Returns a list of AutoCorrect replacements.
Syntax
get replacement list autocorrect Required. An expression that returns a list object.
Example
set myList to get replacement list autocorrect object
Chart Suite
381
Chart Suite
Chart Suite Classes.....................................................................................................................................................381
Chart Suite Commands .............................................................................................................................................444
Chart Suite Classes
area group ...................................................................................................................................................................382
axis................................................................................................................................................................................ 382
axis title........................................................................................................................................................................ 388
bar group ..................................................................................................................................................................... 390
chart..............................................................................................................................................................................390
chart area .....................................................................................................................................................................396
chart fill format...........................................................................................................................................................397
chart group.................................................................................................................................................................. 401
chart object ..................................................................................................................................................................404
chart title...................................................................................................................................................................... 406
column group..............................................................................................................................................................409
corners..........................................................................................................................................................................409
data label ..................................................................................................................................................................... 409
data table .....................................................................................................................................................................412
display unit label........................................................................................................................................................413
doughnut group .........................................................................................................................................................415
down bars.................................................................................................................................................................... 416
drop lines.....................................................................................................................................................................416
error bars .....................................................................................................................................................................417
floor ..............................................................................................................................................................................417
gridlines....................................................................................................................................................................... 418
hilo lines.......................................................................................................................................................................419
interior .........................................................................................................................................................................419
leader lines ..................................................................................................................................................................421
legend...........................................................................................................................................................................421
legend entry ................................................................................................................................................................422
legend key ................................................................................................................................................................... 423
line group .................................................................................................................................................................... 426
pie group .....................................................................................................................................................................427
plot area ....................................................................................................................................................................... 427
radar group .................................................................................................................................................................429
series.............................................................................................................................................................................429
series lines ...................................................................................................................................................................435
series point ..................................................................................................................................................................436
tick labels.....................................................................................................................................................................438
trendline ......................................................................................................................................................................440
up bars .........................................................................................................................................................................441
walls .............................................................................................................................................................................442
xy group....................................................................................................................................................................... 443
Chart Suite
382
Class: area group
Plural
area groups
Represents one or more series plotted in an area chart. A chart contains one or more chart groups,
each chart group contains one or more series, and each series contains one or more points. For
example, a single chart might contain both a line chart group, containing all the series plotted with
the line chart format, and an area chart group, containing all the series plotted with the area chart
format.
Use area group index, where index is the chart-group index number, to return a single area group
object. The following example adds drop lines to area group 1 on the active chart.
set has drop lines of area group 1 of active chart to true
Properties
<Inheritance> chart group
Inherits the properties and elements of the chart group class.
Class: axis
Plural
axes
Represents a single axis in a chart.
Use axis type, group to return a single axis object. Type can be one of the following: category axis,
series axis, or value axis. Group can be primary axis or secondary axis.
The following example sets the category axis title text on the active chart.
set axis1 to (get axis active chart axis type category axis)
set has title of axis1 to true
set axis title text of axis title of axis1 to "1994"
Properties
axis between categories
True if the value axis crosses the category axis between categories. Read/write.
This property applies only to category axes, and it does not apply to 3-D charts.
axis group
Returns the group for the specified axis, chart group, or series. Read-only.
Can be one of the following:
primary axis
secondary axis
For 3-D charts, only primary axis is valid.
Chart Suite
383
axis title
Returns an axis title object that represents the title of the specified axis. Read-only.
axis type
Returns or sets the axis type. Read/write.
Can be one of the following:
category axis
series axis
value axis
base unit
Returns or sets the base unit for the specified category axis. Read/write.
Can be one of the following:
days
months
years
Setting this property has no visible effect if the category type property for the specified axis is
set to category scale. The set value is retained, however, and takes effect when the category type
property is set to time scale.
You cannot set this property for a value axis.
base unit is auto
True if Excel chooses appropriate base units for the specified category axis. The default value
is True. Read/write.
You cannot set this property for a value axis.
border
Returns a border object that represents the border of the object. Read-only.
category names
Returns or sets all the category names for the specified axis, as a list. You can set this property
to either a list or a range object that contains the category names. Read/write.
Category names are really a property of the "special" series in an axis grouping. Deleting or
modifying that special series changes the category names for all series using the axis.
category type
Returns or sets the category axis type. Read/write.
Can be one of the following:
category scale
time scale
automatic scale
You cannot set this property for a value axis.
Chart Suite
384
crosses
Returns or sets the point on the specified axis where the other axis crosses. Read/write.
Can be one of the following:
Constant Meaning
axis crosses automatic
Excel sets the axis crossing point.
axis crosses minimum
The axis crosses at the minimum value.
axis crosses maximum
The axis crosses at the maximum value.
axis crosses custom
The crosses at property specifies the axis crossing point.
This property is not available for 3-D charts or radar charts.
This property can be used for both category and value axes. On the category axis, axis crosses
minimum sets the value axis to cross at the first category, and axis crosses maximum sets the
value axis to cross at the last category.
Note that axis crosses minimum and axis crosses maximum can have different meanings,
depending on the axis.
crosses at
Returns or sets the point on the value axis where the category axis crosses it. Applies only to
the value axis. Read/write.
Setting this property causes the crosses property to change to axis crosses custom.
This property cannot be used on 3-D charts or radar charts.
display unit
Returns or sets the unit label for the specified axis. Read/write.
Can be one of the following:
hundreds
thousands
ten thousands
hundred thousands
millions
ten millions
hundred millions
thousand millions
million millions
custom display unit
If the value is custom display unit, the display unit custom property returns or sets the value of
the displayed units.
Using unit labels when charting large values makes your tick mark labels easier to read. For
example, if you label your value axis in units of hundreds, thousands, or millions, you can use
smaller numeric values at the tick marks on the axis.
display unit custom
If the value of the display unit property is custom display unit, the display unit custom property
returns or sets the value of the displayed units. The value must be from 0 through 10E307.
Read/write.
Using unit labels when charting large values makes your tick mark labels easier to read. For
example, if you label your value axis in units of hundreds, thousands, or millions, you can use
smaller numeric values at the tick marks on the axis.
Chart Suite
385
display unit label
Returns the display unit label object for the specified axis. Returns missing value if the has
display unit label property is set to false. Read-only.
has display unit label
True if the label specified by the display unit or display unit custom property is displayed on the
specified axis. The default value is true. Read/write.
has major gridlines
True if the axis has major gridlines. Only axes in the primary axis group can have gridlines.
Read/write.
has minor gridlines
True if the axis has minor gridlines. Only axes in the primary axis group can have gridlines.
Read/write.
has title
True if the axis has a visible title. An axis title is represented by an axis title object.
Read/write.
height
Returns the height (in points) of the axis. Read-only.
left position
Returns the distance (in points) from the left edge of the axis to the left edge of the chart area.
Read-only.
major gridlines
Returns a gridlines object that represents the major gridlines for the specified axis. Only axes
in the primary axis group can have gridlines. Read-only.
major tick mark
Returns or sets the type of major tick mark for the specified axis. Read/write.
Can be one of the following:
tick mark cross
tick mark inside
tick mark none
tick mark outside
major unit
Returns or sets the major units for the axis. Read/write.
Setting this property sets the major unit is auto property to false.
To set tick mark spacing on the category axis, use the tick mark spacing property.
major unit is auto
True if Excel calculates the major units for the axis. Read/write.
Setting the major unit property sets this property to false.
Chart Suite
386
major unit scale
Returns or sets the major unit scale value for the category axis when the category type property
is set to time scale. Read/write.
Can be one of the following:
days
months
years
maximum scale
Returns or sets the maximum value on the axis. Read/write.
Setting this property sets the maximum scale is auto property to false.
maximum scale is auto
True if Excel calculates the maximum value for the axis. Read/write.
Setting the maximum scale property sets this property to false.
minimum scale
Returns or sets the minimum value on the axis. Read/write.
Setting this property sets the minimum scale is auto property to false.
minimum scale is auto
True if Excel calculates the minimum value for the axis. Read/write.
Setting the minimum scale property sets this property to false.
minor gridlines
Returns a gridlines object that represents the minor gridlines for the specified axis. Only axes
in the primary axis group can have gridlines. Read-only.
minor tick mark
Returns or sets the type of minor tick mark for the specified axis. Read/write.
Can be one of the following:
tick mark cross
tick mark inside
tick mark none
tick mark outside
minor unit
Returns or sets the minor units on the axis. Read/write.
Setting this property sets the minor unit is auto property to false.
To set tick mark spacing on the category axis, use the tick mark spacing property.
Chart Suite
387
minor unit is auto
True if Excel calculates minor units for the axis. Read/write.
Setting the minor unit property sets this property to false.
minor unit scale
Returns or sets the minor unit scale value for the category axis when the category type property
is set to time scale. Read/write.
Can be one of the following:
days
months
years
reverse plot order
True if Excel plots data points from last to first. Read/write.
This property cannot be used on radar charts.
scale type
Returns or sets the value axis scale type. Can be scale linear or scale logarithmic. Applies only
to the value axis. Read/write.
A logarithmic scale uses base 10 logarithms.
tick label position
Describes the position of tick-mark labels on the specified axis. Read/write.
Can be one of the following:
tick label position high
tick label position low
tick label position next to axis
tick label position none
tick label spacing
Returns or sets the number of categories or series between tick-mark labels. Applies only to
category and series axes. Read/write.
Tick-mark label spacing on the value axis is always calculated by Excel.
tick labels
Returns a tick labels object that represents the tick-mark labels for the specified axis. Read-
only.
tick mark spacing
Returns or sets the number of categories or series between tick marks. Applies only to category
and series axes. Read/write.
To set tick-mark spacing on the value axis, use the major unit and minor unit properties.
Chart Suite
388
top
Returns the distance (in points) from the top edge of the axis to the top of the chart area. Read-
only.
width
Returns the width of the axis. Read-only.
Class: axis title
Plural
axis titles
Elements
character
Represents a chart axis title.
Use the axis title property to return an axis title object. The following example activates the active
chart, sets the value axis title text, sets the font color to red, and formats the word "millions" as italic.
set axis1 to (get axis active chart axis type value axis)
set has title of axis1 to true
set t1 to axis title of axis1
set axis title text of t1 to "millions"
set font color index of font object of t1 to 3
set italic of font object of t1 to true
If the has title property for the axis is false, trying to use the axis title object will generate an access
violation.
Properties
auto scale font
True if the text in the axis title changes font size when the axis title size changes. The default
value is true. Read/write.
axis title text
Returns or sets the text for the axis title. Read/write.
border
Returns a border object that represents the border of the axis title. Read-only.
caption
Returns or sets the axis title text. Read/write.
chart fill format object
Returns a chart fill format object that contains fill formatting properties for the axis title. Read-
only.
font object
Returns a font object that represents the font of the axis title. Read-only.
Chart Suite
389
horizontal alignment
Returns or sets the horizontal alignment for the axis title. Read/write.
Can be one of the following:
horizontal align center
horizontal align center across selection
horizontal align distributed
horizontal align fill
horizontal align general
horizontal align justify
horizontal align left
horizontal align right
The horizontal align distributed alignment style works only in the Japanese version of Excel
or in an English version of Excel that you have registered as Japanese by using the Microsoft
Language Register application.
interior object
Returns an interior object that represents the interior of the axis title. Read-only.
left position
Returns or sets the position (in points) of the axis title. Read/write.
name
Returns the name of the axis title. Read-only.
orientation
Returns or sets the axis title's orientation. Can be a number value between -90 and 90 degrees.
Read/write.
reading order
This property is not currently supported.
shadow
True if the font is a shadow font or if the axis title has a shadow. Read/write.
top
Returns or sets the distance (in points) from the top edge of the axis title to the top of the chart
area. Read/write.
Chart Suite
390
vertical alignment
Returns or sets the vertical alignment of the axis title. Read/write.
Can be one of the following:
vertical alignment top
vertical alignment center
vertical alignment bottom
vertical alignment justify
vertical alignment distributed
The vertical alignment distributed alignment style works only in the Japanese version of
Excel or in an English version of Excel that you have registered as Japanese by using the
Microsoft Language Register application.
Class: bar group
Plural
bar groups
Represents one or more series plotted in a bar chart. A chart contains one or more chart groups, each
chart group contains one or more series, and each series contains one or more points. For example, a
single chart might contain both a line chart group, containing all the series plotted with the line
chart format, and a bar chart group, containing all the series plotted with the bar chart format.
Use bar group index, where index is the chart-group index number, to return a single bar group
object. The following example adds drop lines to bar group 1 on the active chart.
set has drop lines of bar group 1 of active chart to true
Properties
<Inheritance> chart group
Inherits the properties and elements of the chart group class.
Class: chart
Plural
charts
Elements
shape
arc
area group
bar group
button
chart group
chart object
checkbox
column group
doughnut group
dropdown
hyperlink
label
line group
line
listbox
option button
oval
pie group
radar group
rectangle
scrollbar
series
spinner
textbox
xy group
Chart Suite
391
Represents a chart in a workbook. The chart can be either an embedded chart (contained in a chart
object object) or a separate chart sheet.
Use the chart property of the chart object class to return a chart object that represents the chart
contained in a chart object object. The following example sets the pattern for the chart area in a
chart sheet.
set color index of interior object of chart area object of active chart to 43
Properties
area threeD group
Returns a chart group object that represents the area chart group on a 3-D chart. Read-only.
auto scaling
True if Excel scales a 3-D chart so that it's closer in size to the equivalent 2-D chart. The right
angle axes property must be set to true. Read/write.
bar shape
Returns or sets the shape used with the 3-D bar or column chart. Read/write.
Can be one of the following:
box
pyramid to point
pyramid to max
cylinder
cone to point
cone to max
bar threeD group
Returns a chart group object that represents the bar chart group on a 3-D chart. Read-only.
chart area object
Returns a chart area object that represents the complete chart area for the chart. Read-only.
chart title
Returns a chart title object that represents the title of the specified chart. Read-only.
Chart Suite
392
chart type
Returns or sets the chart type. Read/write.
Can be one of the following:
column clustered
column stacked
column stacked 100
ThreeD column clustered
ThreeD column stacked
ThreeD column stacked 100
bar clustered
bar stacked
bar stacked 100
ThreeD bar clustered
ThreeD bar stacked
ThreeD bar stacked 100
line stacked
line stacked 100
line markers
line markers stacked
line markers stacked 100
pie of pie
pie exploded
ThreeD pie exploded
bar of pie
xy scatter smooth
xy scatter smooth no markers
xy scatter lines
xy scatter lines no markers
area stacked
area stacked 100
ThreeD area stacked
ThreeD area stacked 100
doughnut exploded
radar markers
radar filled
surface
surface wireframe
surface top view
surface top view wireframe
bubble
bubble ThreeD effectstock HLC
stock OHLC
stock VHLC
stock VOHLC
cylinder column clustered
cylinder column stacked
cylinder column stacked 100
cylinder bar clustered
cylinder bar stacked
cylinder bar stacked 100
cylinder column
cone column clustered
cone column stacked
cone column stacked 100
cone bar clustered
cone bar stacked
cone bar stacked 100
cone col
pyramid column clustered
pyramid column stacked
pyramid column stacked 100
pyramid bar clustered
pyramid bar stacked
pyramid bar stacked 100
pyramid column
ThreeD column
line chart
ThreeD line
ThreeD pie
pie chart
xyscatter
ThreeD area
area chart
doughnut
radar
column threeD group
Returns a chart group object that represents the column chart group on a 3-D chart. Read-only.
corners object
Returns a corners object that represents the corners of a 3-D chart. Read-only.
Chart Suite
393
data table object
Returns a data table object that represents the chart data table. Read-only.
depth percent
Returns or sets the depth of a 3-D chart as a percentage of the chart width (between 20 and
2000 percent). Read/write.
display blanks as
Returns or sets the way that blank cells are plotted on a chart. Read/write.
Can be one of the following:
interpolated
not plotted
zero
elevation
Returns or sets the elevation (in degrees) of the 3-D chart view. Read/write.
The chart elevation is the height at which you view the chart, in degrees. The default is 15 for
most chart types. The value of this property must be between -90 and 90, except for 3-D bar
charts, where it must be between 0 and 44.
entry index
Returns the index number of the object within the elements of the parent object. Read-only.
floor object
Returns a floor object that represents the floor of the 3-D chart. Read-only.
gap depth
Returns or sets the distance between the data series in a 3-D chart, as a percentage of the
marker width. The value of this property must be between 0 and 500. Read/write.
has data table
True if the chart has a data table. Read/write.
has legend
True if the chart has a legend. Read/write.
has title
True if the chart has a visible title. A chart title is represented by a chart title object.
Read/write.
height percent
Returns or sets the height of a 3-D chart as a percentage of the chart width (between 5 and 500
percent). Read/write.
legend object
Returns a legend object that represents the legend for the chart. Read-only.
line threeD group
Returns a chart group object that represents the line chart group on a 3-D chart. Read-only.
Chart Suite
394
name
Returns or sets the name of the chart. Read/write.
page setup object
Returns a page setup object that contains all the page setup settings for the specified object.
Read-only.
perspective
Returns or sets the perspective for the 3-D chart view. Must be between 0 and 100. This
property is ignored if the right angle axes property is true. Read/write.
pie threeD group
Returns a chart group object that represents the pie chart group on a 3-D chart. Read-only.
plot area object
Returns a plot area object that represents the plot area of a chart. Read-only.
plot by
Returns or sets the way columns or rows are used as data series on the chart. Read/write.
Can be one of the following:
by columns
by rows
plot visible only
True if only visible cells are plotted. False if both visible and hidden cells are plotted.
Read/write.
protect contents
True if the entire chart is protected. Read-only.
protect data
True if series formulas cannot be modified by the user. Read/write.
protect drawing objects
True if shapes are protected. Read-only.
protect formatting
True if chart formatting cannot be modified by the user. Read/write.
When this property is true, the Object command on the Format menu is disabled and chart
elements cannot be added, moved, resized, or deleted.
protect goal seek
True if the user cannot modify chart data points with mouse actions. Read/write.
protect selection
True if chart elements cannot be selected. Read/write.
When this property is true, shapes cannot be added to the chart, and the click and double
click events for chart elements don't occur.
Chart Suite
395
protection mode
True if user-interface-only protection is turned on. To turn on user interface protection, use the
protect chart command with the user interface only argument set to true. Read-only.
right angle axes
True if the chart axes are at right angles, independent of chart rotation or elevation. Applies
only to 3-D line, column, and bar charts. Read/write.
If this property is true, the perspective property is ignored.
rotation
Returns or sets the rotation of the 3-D chart view (the rotation of the plot area around the z-
axis, in degrees). The value of this property must be from 0 to 360, except for 3-D bar charts,
where the value must be from 0 to 44. The default value is 20. Applies only to 3-D charts.
Read/write.
show window
True if the embedded chart is displayed in a separate window. The chart object used with this
property must refer to an embedded chart. Read/write.
size with window
True if Excel resizes the chart to match the size of the chart sheet window. False if the chart
size is not attached to the window size. Applies only to chart sheets (does not apply to
embedded charts). Read/write.
surface group
Returns a chart group object that represents the surface chart group on a 3-D chart. Read-only.
visible
Returns or sets whether the chart is visible. Read/write.
Can be one of the following:
sheet visible
sheet hidden
sheet very hidden
If you set this property to sheet very hidden, the chart is hidden so that the only way for you
to make it visible again is by setting this property to sheet visible (the user cannot make the
object visible).
walls and gridlines twoD
True if gridlines are drawn two-dimensionally on a 3-D chart. Read/write.
walls object
Returns a walls object that represents the walls of the 3-D chart. Read-only.
This property does not apply to 3-D pie charts.
Chart Suite
396
Class: chart area
Plural
chart areas
Represents the chart area of a chart. The chart area on a 2-D chart contains the axes, the chart title,
the axis titles, and the legend. The chart area on a 3-D chart contains the chart title and the legend; it
does not include the plot area (the area within the chart area where the data is plotted). For
information about formatting the plot area, see the plot area object.
Use the chart area property to return the chart area object. The following example sets the pattern for
the chart area in a chart sheet.
set pattern of interior object of chart area object ¬
of active chart to twenty percent pattern
Properties
auto scale font
True if the text in the chart area changes font size when the chart area size changes. The
default value is true. Read/write.
border
Returns a border object that represents the border of the chart area. Read-only.
chart fill format object
Returns a chart fill format object that contains fill formatting properties for the chart area.
Read-only.
font object
Returns a font object that represents the font of the text in the chart area. Read-only.
height
Returns the height (in points) of the chart area. Read-only.
interior object
Returns an interior object that represents the interior of the chart area. Read-only.
left position
Returns or sets the position (in points) of the chart area. Read/write.
name
Returns the name of the chart area. Read-only.
shadow
True if the chart area has a shadow. Read/write.
top
Returns or sets the distance (in points) from the top edge of the chart area to the top of row 1
(on a worksheet). Read/write.
width
Returns the width of the chart area. Read-only.
Chart Suite
397
Class: chart fill format
Plural
chart fill formats
Used only with charts. Represents fill formatting for chart elements.
To return a chart fill format object, use the chart fill format object property of the chart area class. The
following example sets the foreground color, background color, and gradient for the chart area fill
on chart one.
set background scheme color of chart fill format object ¬
of chart area object of active chart to 23
set foreground scheme color of chart fill format object ¬
of chart area object of active chart to 3
chart one color gradient chart area object of active chart ¬
gradient style horizontal gradient variant 3 degree 0.34
Properties
back color
Returns the fill background color. Read-only.
background scheme color
Returns or sets the background color as an index in the current color scheme. Read/write.
The following illustration shows the color-index values in the default color palette.
chart fill format type
Returns the fill type. Read-only.
Can be one of the following:
fill unset
fill solid
fill patterned
fill gradient
fill textured
fill background
fill picture
Chart Suite
398
fore color
Returns the fill foreground color. Read-only.
foreground scheme color
Returns or sets the foreground color as an index in the current color scheme. Read/write.
For an illustration showing the color-index values in the default color palette, see background
scheme color.
gradient color type
Returns the gradient color type for the specified fill. Read-only.
Can be one of the following:
gradient type unset
single shade gradient type
two colors gradient type
preset colors gradient type
gradient degree
Returns the gradient degree of the specified one-color shaded fill as a floating-point value
from 0.0 (dark) through 1.0 (light). Read-only.
To set the gradient degree for the fill, use the chart one color gradient command.
gradient style
Returns the gradient style for the specified fill. Read-only.
Can be one of the following:
gradient unset
horizontal gradient
vertical gradient
diagonal up gradient
diagonal down gradient
from corner gradient
from center gradient
To set the gradient style for the fill, use the chart one color gradient or chart two color
gradient command.
gradient variant
Returns the shade variant for the specified fill as an integer value from 1 through 4. The values
for this property correspond to the gradient variants (numbered from left to right and from
top to bottom) on the Gradient tab in the Fill Effects dialog box. Read-only.
To set the gradient variant for the fill, use the chart one color gradient or chart two color
gradient command.
Chart Suite
399
pattern
Returns or sets the fill pattern. Read-only.
Can be one of the following:
pattern unset
five percent pattern
ten percent pattern
twenty percent pattern
twenty five percent pattern
thirty percent pattern
forty percent pattern
fifty percent pattern
sixty percent pattern
seventy percent pattern
seventy five percent pattern
eighty percent pattern
ninety percent pattern
dark horizontal pattern
dark vertical pattern
dark downward diagonal pattern
dark upward diagonal pattern
small checker board pattern
trellis pattern
light horizontal pattern
light vertical pattern
light downward diagonal pattern
light upward diagonal pattern
small grid pattern
dotted diamond pattern
wide downward diagonal
wide upward diagonal pattern
dashed upward diagonal pattern
dashed downward diagonal pattern
narrow vertical pattern
narrow horizontal pattern
dashed vertical pattern
dashed horizontal pattern
large confetti pattern
large grid pattern
horizontal brick pattern
large checker board pattern
small confetti pattern
zig zag pattern
solid diamond pattern
diagonal brick pattern
outlined diamond pattern
plaid pattern
sphere pattern
weave pattern
dotted grid pattern
divot pattern
shingle pattern
wave pattern
preset gradient type
Returns the preset gradient type for the specified fill. Read-only.
Can be one of the following:
preset gradient unset
gradient early sunset
gradient late sunset
gradient nightfall
gradient daybreak
gradient horizon
gradient desert
gradient ocean
gradient calm water
gradient fire
gradient fog
gradient moss
gradient peacock
gradient wheat
gradient parchment
gradient mahogany
gradient rainbow
gradient rainbow2
gradient gold
gradient gold2
gradient brass
gradient chrome
gradient chrome2
gradient silver
gradient sapphire
To set the preset gradient type for the fill, use the preset chart gradient command.
Chart Suite
400
preset texture
Returns the preset texture for the specified fill. Read-only.
Can be one of the following:
preset texture unset
texture papyrus
texture canvas
texture denim
texture woven mat
texture water droplets
texture paper bag
texture fish fossil
texture sand
texture green marble
texture white marble
texture brown marble
texture granite
texture newsprint
texture recycled paper
texture parchment
texture stationery
texture blue tissue paper
texture pink tissue paper
texture purple mesh
texture bouquet
texture cork
texture walnut
texture oak
texture medium wood
To set the preset texture for the fill, use the preset chart textured command.
texture name
Returns the name of the custom texture file for the specified fill. Read-only.
To set the texture file for the fill, use the chart user picture or chart user textured command.
texture type
Returns the texture type for the specified fill. Read-only.
Can be one of the following:
texture type texture type unset
texture type preset texture
texture type user defined texture
To set the texture type for the fill, use the chart user textured command.
transparency
Returns or sets the degree of transparency of the specified fill as a value from 0.0 (opaque)
through 1.0 (clear). Read/write.
The value of this property affects the appearance of solid-colored fills and lines only; it has no
effect on the appearance of patterned lines or patterned, gradient, picture, or textured fills.
visible
True if the specified object is visible. Read/write.
Chart Suite
401
Class: chart group
Plural
chart groups
Elements
series
Represents one or more series plotted in a chart with the same format. A chart contains one or more
chart groups, each chart group contains one or more series, and each series contains one or more
points. For example, a single chart might contain both a line chart group, containing all the series
plotted with the line chart format, and a bar chart group, containing all the series plotted with the
bar chart format.
Use chart group index, where index is the chart-group index number, to return a single chart group
object. The following example adds drop lines to chart group 1 on the active chart.
set has drop lines of chart group 1 of active chart to true
Because the index number for a particular chart group can change if the chart format used for that
group is changed, it may be easier to use one of the named chart group shortcut classes to return a
particular chart group. The pie group class returns the list of pie chart groups in a chart, the line
group class returns the list of line chart groups, and so on. Each of these classes can be used with an
index number to return a single chart group object, or without an index number to return the list of
chart group objects in the chart. The following chart group classes are available:
area group
bar group
column group
doughnut group
line group
pie group
radar group
series group
xy group
Properties
axis group
Returns the group for the specified axis, chart group, or series. Read/write.
Can be one of the following:
primary axis
secondary axis
For 3-D charts, only primary axis is valid.
Chart Suite
402
bubble scale
Returns or sets the scale factor for bubbles in the specified chart group. Can be an integer value
from 0 (zero) to 300, corresponding to a percentage of the default size. Applies only to bubble
charts. Read/write.
color scheme
Returns or sets the preset color scheme to apply to a chart. The color scheme is represented by
a number between 1 and 18 corresponding to which of the color schemes to apply.
Read/write.
color variance
Varies the color within a data series. Read/write. Can be one of the following:
Constant Meaning
vary by grayscale
Uses black for all of the data series, with each data series shown at a
different level of opacity.
vary by same color
Uses a single color for a chart that has only one data series.
vary by color
Uses a different color for each data series.
vary by shade
Uses a single color for all of the data series, with each data series shown
at a different level of opacity.
doughnut hole size
Returns or sets the size of the hole in a doughnut chart group. The hole size is expressed as a
percentage of the chart size, between 10 and 90 percent. Read/write.
down bars object
Returns a down bars object that represents the down bars on a line chart. Applies only to line
charts. Read-only.
drop lines object
Returns a drop lines object that represents the drop lines for a series on a line chart or area
chart. Applies only to line charts or area charts. Read-only.
entry index
Returns the index number of the object within the elements of the parent object. Read-only.
first slice angle
Returns or sets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise
from vertical). Applies only to pie, 3-D pie, and doughnut charts. Read/write.
gap width
For bar and column charts, returns or sets the space between bar or column clusters, as a
percentage of the bar or column width. The value of this property must be between 0 and 500.
Read/write.
For pie-of-pie and bar-of- pie charts, returns or sets the space between the primary and
secondary sections of the chart. The value of this property must be between 5 and 200.
Read/write.
Chart Suite
403
has drop lines
True if the line chart or area chart has drop lines. Applies only to line and area charts.
Read/write.
has hi lo lines
True if the line chart has high-low lines. Applies only to line charts. Read/write.
has radar axis labels
True if a radar chart has axis labels. Applies only to radar charts. Read/write.
has series lines
True if a stacked column chart or bar chart has series lines or if a pie- of-pie chart or bar- of-pie
chart has connector lines between the two sections. Applies only to stacked column charts, bar
charts, pie-of-pie charts, or bar-of-pie charts. Read/write.
has threeD shading
True if the chart group has three-dimensional shading. Read/write.
has up down bars
True if a line chart has up and down bars. Applies only to line charts. Read/write.
hilo lines Object
Returns a hilo lines object that represents the high-low lines for a series on a line chart.
Applies only to line charts. Read-only.
overlap
Specifies how bars and columns are positioned. Can be a value between -100 and 100. Applies
only to 2-D bar charts and 2-D column charts. Read/write.
If this property is set to -100, bars are positioned so that there is one bar width between them.
If the overlap is 0 (zero), there is no space between bars (one bar starts immediately after the
preceding bar). If the overlap is 100, bars are positioned on top of each other.
radar axis labels
Returns a tick labels object that represents the radar axis labels for the specified chart group.
Read-only.
second plot size
Returns or sets the size of the secondary section of either a pie-of-pie chart or a bar-of-pie
chart, as a percentage of the size of the primary pie. Can be a value from 5 to 200. Read/write.
series lines object
Returns a series lines object that represents the series lines for a stacked bar chart or a stacked
column chart. Applies only to stacked bar charts and stacked column charts. Read-only.
show negative bubbles
True if negative bubbles are shown for the chart group. Valid only for bubble charts.
Read/write.
Chart Suite
404
size represents
Returns or sets what the bubble size represents on a bubble chart. Read/write.
Can be one of the following:
size is area
size is width
split type
Returns or sets the way the two sections of either a pie-of-pie chart or a bar-of-pie chart are
split. Read/write.
Can be one of the following:
split by position
split by percent value
split by custom split
split by value
split value
Returns or sets the threshold value separating the two sections of either a pie-of-pie chart or a
bar-of-pie chart. Read/write.
up bars object
Returns an up bars object that represents the up bars on a line chart. Applies only to line
charts. Read-only.
vary by categories
True if Excel assigns a different color or pattern to each data marker. The chart must contain
only one series. Read/write.
Class: chart object
Plural
chart objects
Represents an embedded chart on a worksheet. The chart object object acts as a container for a chart
object. Properties and commands for the chart object object control the appearance and size of the
embedded chart on the worksheet.
Use chart object index, where index is the embedded chart index number or name, to return a single
chart object object. The following example sets the pattern for the chart object object in chart object
1 on the active chart.
set ci to interior object of chart area object of chart of chart object 1
set pattern of ci to pattern checker
The embedded chart name is shown in the Name box when the embedded chart is selected. Use the
name property to set or return the name of the chart object object. The following example puts
rounded corners on chart object 1 on the active chart.
set rounded corners of chart object 1 of active sheet to true
Chart Suite
405
Properties
border
Returns a border object that represents the border of the chart object. Read-only.
bottom right cell
Returns a range object that represents the cell that lies under the lower-right corner of the chart
object. Read-only.
chart
Returns a chart object that represents the chart contained in the object. Read-only.
enabled
True if the object is enabled. Read/write.
entry index
Returns the index number of the chart object within the elements of the parent object. Read-
only.
height
Returns or sets the height (in points) of the chart object. Read/write.
interior object
Returns an interior object that represents the interior of the chart object. Read-only.
left position
Returns or sets the distance (in points) from the left edge of the chart object to the left edge of
column A. Read/write.
locked
True if the chart object is locked; false if the chart object can be modified when the sheet is
protected. Read/write.
name
Returns or sets the name of the chart object. Read/write.
on action
Returns or sets the name of a Visual Basic macro or a string of AppleScript commands that is
run when the chart object is clicked. Read/write.
Visual Basic macros are saved with the document, while AppleScript commands are not saved
with the document.
placement
Returns or sets the way the chart object is attached to the cells below it. Read/write.
Can be one of the following:
placement free floating
placement move
placement move and size
Chart Suite
406
print object
True if the chart object will be printed when the document is printed. Read/write.
protect chart object
True if the embedded chart frame cannot be moved, resized, or deleted. Read/write.
rounded corners
True if the embedded chart has rounded corners. Read/write.
shadow
True if the chart object has a shadow. Read/write.
top
Returns or sets the distance (in points) from the top edge of the chart object to the top of
column A. Read/write.
top left cell
Returns a range object that represents the cell that lies under the upper-left corner of the
specified object. Read-only.
visible
True if the chart object is visible. Read/write.
width
Returns the width of the chart object. Read-only.
z order position
Returns the position of the chart object in the z-order, which corresponds to the object's index
number. Read-only.
Whenever you make a new shape or object, it's added to the front of the z-order by default.
Class: chart title
Plural
chart titles
Elements
character
Represents the chart title.
Use the chart title property to return the chart title object. The following example adds a title to the
active chart.
set has title of active chart to true
If the has title property for the chart is false, trying to use the chart title object will generate an
access violation.
Chart Suite
407
Properties
auto scale font
True if the text in the chart title changes font size when the chart title size changes. The default
value is true. Read/write.
border
Returns a border object that represents the border of the chart title. Read-only.
caption
Returns or sets the chart title text. Read/write.
chart fill format object
Returns a chart fill format object that contains fill formatting properties for the chart title.
Read-only.
chart title text
Returns or sets the text for the chart title. Read/write.
font object
Returns a font object that represents the font of the chart title. Read-only.
horizontal alignment
Returns or sets the horizontal alignment for the chart title. Read/write.
Can be one of the following:
horizontal align center
horizontal align center across selection
horizontal align distributed
horizontal align fill
horizontal align general
horizontal align justify
horizontal align left
horizontal align right
The horizontal align distributed alignment style works only in the Japanese version of Excel
or in an English version of Excel that you have registered as Japanese by using the Microsoft
Language Register application.
interior object
Returns an interior object that represents the interior of the chart title. Read-only.
left position
Returns or sets the position (in points) of the chart title. Read/write.
Chart Suite
408
name
Returns the name of the chart title. Read-only.
orientation
Returns or sets the chart title's orientation. Read/write.
Can be one of the following:
orientation down
orientation horizontal
orientation upward
orientation vertical
Can also be a number value between -90 and 90 degrees.
reading order
This property is not current supported.
shadow
True if the font is a shadow font or if the chart title has a shadow. Read/write.
top
Returns or sets the distance (in points) from the top edge of the chart title to the top of the
chart area. Read/write.
vertical alignment
Returns or sets the vertical alignment of the chart title. Read/write.
Can be one of the following:
vertical alignment top
vertical alignment center
vertical alignment bottom
vertical alignment justify
vertical alignment distributed
The vertical alignment distributed alignment style works only in the Japanese version of
Excel or in an English version of Excel that you have registered as Japanese by using the
Microsoft Language Register application.
Chart Suite
409
Class: column group
Plural
column groups
Represents one or more series plotted in a column chart. A chart contains one or more chart groups,
each chart group contains one or more series, and each series contains one or more points. For
example, a single chart might contain both a line chart group, containing all the series plotted with
the line chart format, and a bar chart group, containing all the series plotted with the bar chart
format.
Use column group index, where index is the chart-group index number, to return a single column
group object. The following example adds drop lines to column group 1 on the active chart.
set has drop lines of column group 1 of active chart to true
Properties
<Inheritance> chart group
Inherits the properties and elements of the chart group class.
Class: corners
Represents the corners of a 3-D chart.
Use the corners object property to return the corners object. The following example gets the name of
the corners of the active chart.
get name of corners object of active chart
If the chart isn't a 3-D chart, the corners object property fails.
Properties
name
Returns the name of the corners object. Read-only.
Class: data label
Plural
data labels
Elements
character
Represents the data label on a chart series point or trendline.
Use data label index, where index is the data-label index number, to return a single data label object.
The following example sets the data label text of series 1 in the active chart to "Data Label."
set data label text of data labels of series 1 of active chart to "Data Label"
To return the data label object for a single point, use the data label object property of the series point
class. The following example turns on the data label for point 1 in series 1 on the active chart.
apply data labels series point 1 of series 1 of active chart
Chart Suite
410
On a trendline, the data label object property returns the text shown with the trendline. This can be
the equation, the R-squared value, or both (if both are showing). The following example sets the
trendline text to show only the equation.
set display R squared of trendline 1 of series 1 of active chart to false
set display equation of trendline 1 of series 1 of active chart to true
Properties
auto scale font
True if the text in the data label changes font size when the data label size changes. The default
value is true. Read/write.
auto text
True if the data label automatically generates appropriate text based on context. Read/write.
border
Returns a border object that represents the border of the data label. Read-only.
caption
Returns or sets the data label text. Read/write.
chart fill format object
Returns a chart fill format object that contains fill formatting properties for the data label.
Read-only.
data label text
Returns or sets the text for the data label. Read/write.
data label type
Returns or sets the data label type. Read/write.
Can be one of the following:
data labels show none
data labels show value
data labels show percent
data labels show label
data labels show label and percent
data labels show bubble sizes
font object
Returns a font object that represents the font of the data label. Read-only.
Chart Suite
411
horizontal alignment
Returns or sets the horizontal alignment for the data label. Read/write.
Can be one of the following:
horizontal align center
horizontal align center across selection
horizontal align distributed
horizontal align fill
horizontal align general
horizontal align justify
horizontal align left
horizontal align right
The horizontal align distributed alignment style works only in the Japanese version of Excel
or in an English version of Excel that you have registered as Japanese by using the Microsoft
Language Register application.
interior object
Returns an interior object that represents the interior of the data label. Read-only.
left position
Returns or sets the position (in points) of the data label. Read/write.
name
Returns the name of the data label. Read-only.
number format
Returns or sets the format code for the data label. Read/write.
You'll find a list of format codes under the Custom category on the Number tab in the Format
Cells dialog box.
number format linked
True if the number format is linked to the cells (so that the number format changes in the
labels when it changes in the cells). Read/write.
orientation
Returns or sets the orientation of the data label. Read/write.
Can be one of the following:
orientation down
orientation horizontal
orientation upward
orientation vertical
Can also be a number value between -90 and 90 degrees.
Chart Suite
412
position
Returns or sets the position of the data label. Read/write.
Can be one of the following:
label position center
label position above
label position below
label position left
label position right
label position outside end
label position inside end
label position inside base
label position best fit
label position mixed
label position custom
reading order
This property is not currently supported.
shadow
True if the font is a shadow font or if the data label has a shadow. Read/write.
show legend key
True if the data label legend key is visible. Read/write.
top
Returns or sets the distance (in points) from the top edge of the data label to the top of the
chart area. Read/write.
vertical alignment
Returns or sets the vertical alignment of the data label. Read/write.
Can be one of the following:
vertical alignment top
vertical alignment center
vertical alignment bottom
vertical alignment justify
vertical alignment distributed
The vertical alignment distributed alignment style works only in the Japanese version of
Excel or in an English version of Excel that you have registered as Japanese by using the
Microsoft Language Register application.
Class: data table
Plural
data tables
Represents a chart data table.
Use the data table object property to return a data table object. The following example adds a data
table with an outline border to the active chart.
set has data table of active chart to true
set has border outline of data table object of active chart to true
Chart Suite
413
Properties
auto scale font
True if the text in the data table changes font size when the data table size changes. The default
value is true. Read/write.
border
Returns a border object that represents the border of the data table. Read-only.
font object
Returns a font object that represents the font of the data table. Read-only.
has border horizontal
True if the chart data table has horizontal cell borders. Read/write.
has border outline
True if the chart data table has outline borders. Read/write.
has border vertical
True if the chart data table has vertical cell borders. Read/write.
show legend key
True if the data table legend key is visible. Read/write.
Class: display unit label
Plural
display unit labels
Elements
character
Represents a unit label on an axis in the specified chart. Unit labels are useful for charting large
values — for example, in the millions or billions. You can make the chart more readable by using a
single unit label instead of large numbers at each tick mark.
To return the display unit label object, use the display unit label property of the axis class. The
following example sets the display label caption to "millions" on the value axis in the active chart.
set Axis1 to (get axis active chart axis type value axis)
set display unit of Axis1 to millions
set has display unit label of Axis1 to true
set caption of display unit label of Axis1 to "In millions"
Properties
auto scale font
True if the text in the display unit label changes font size when the display unit label size
changes. The default value is true. Read/write.
border
Returns a border object that represents the border of the display unit label. Read-only.
Chart Suite
414
caption
Returns or sets the display unit label text. Read/write.
chart fill format object
Returns a chart fill format object that contains fill formatting properties for the display unit
label. Read-only.
display label unit text
Returns or sets the text for the display unit label. Read/write.
font object
Returns a font object that represents the font of the display unit label. Read-only.
horizontal alignment
Returns or sets the horizontal alignment for the display unit label. Read/write.
Can be one of the following:
horizontal align center
horizontal align center across selection
horizontal align distributed
horizontal align fill
horizontal align general
horizontal align justify
horizontal align left
horizontal align right
The horizontal align distributed alignment style works only in the Japanese version of Excel
or in an English version of Excel that you have registered as Japanese by using the Microsoft
Language Register application.
interior object
Returns an interior object that represents the interior of the display unit label. Read-only.
left position
Returns or sets the position (in points) of the display unit label. Read/write.
name
Returns the name of the display unit label. Read-only.
Chart Suite
415
orientation
Returns or sets the orientation of the display unit label. Read/write.
Can be one of the following:
orientation down
orientation horizontal
orientation upward
orientation vertical
Can also be a number value between -90 and 90 degrees.
reading order
This property is not currently supported.
shadow
True if the font is a shadow font or if the display unit label has a shadow. Read/write.
top
Returns or sets the distance (in points) from the top edge of the display unit label to the top of
the chart area. Read/write.
vertical alignment
Returns or sets the vertical alignment of the display unit label. Read/write.
Can be one of the following:
vertical alignment top
vertical alignment center
vertical alignment bottom
vertical alignment justify
vertical alignment distributed
The vertical alignment distributed alignment style works only in the Japanese version of
Excel or in an English version of Excel that you have registered as Japanese by using the
Microsoft Language Register application.
Class: doughnut group
Plural
doughnut groups
Represents one or more series plotted in a doughnut chart. A chart contains one or more chart
groups, each chart group contains one or more series, and each series contains one or more points.
For example, a single chart might contain both a line chart group, containing all the series plotted
with the line chart format, and a doughnut chart group, containing all the series plotted with the
doughnut chart format.
Chart Suite
416
Use doughnut group index, where index is the chart-group index number, to return a single
doughnut group object. The following example adds drop lines to doughnut group 1 on the active
chart.
set has drop lines of doughnut group 1 of active chart to true
Properties
<Inheritance> chart group
Inherits the properties and elements of the chart group class.
Class: down bars
Represents the down bars in a chart group. Down bars connect points on the first series in the chart
group with lower values on the last series (the lines go down from the first series). Only 2-D line
groups that contain at least two series can have down bars.
There is no object that represents a single down bar; up bars and down bars are either turned on or
off for all points in a chart group.
Use the down bars object property to return the down bars object. The following example turns on up
and down bars for chart group 1 on the active chart.
set has up down bars of chart group 1 of active chart to true
If the has up down bars property is false, most properties of the down bars object are disabled.
Properties
border
Returns a border object that represents the border of the object. Read-only.
chart fill format object
Returns a chart fill format object that contains fill formatting properties for the object. Read-
only.
interior object
Returns an interior object that represents the interior of the object. Read-only.
name
Returns the name of the object. Read-only.
Class: drop lines
Represents the drop lines in a chart group. Drop lines connect the points in the chart with the x-axis.
Only line and area chart groups can have drop lines.
There is no object that represents a single drop line; drop lines are either turned on or off for all
points in a chart group.
Use the drop lines object property to return the drop lines object. The following example turns on
drop lines for an active chart.
set has drop lines of chart group 1 of active chart to true
If the has drop lines property is false, most properties of the drop lines object are disabled.
Chart Suite
417
Properties
border
Returns a border object that represents the border of the object. Read-only.
name
Returns the name of the object. Read-only.
Class: error bars
Represents the error bars on a chart series. Error bars indicate the degree of uncertainty for chart
data. Only series in area, bar, column, line, and scatter groups on a 2-D chart can have error bars.
Only series in scatter groups can have x and y error bars.
There is no object that represents a single error bar; x error bars or y error bars are either turned on
or off for all points in a series.
Use the error bars property to return the error bars object. The following example turns on error bars
for series 1 in the active chart and then sets the end style for the error bars.
set has error bars of series 1 of active chart to true
set end style of error bars of series 1 of active chart to cap
The error bar command changes the error bar format and type.
Properties
border
Returns a border object that represents the border of the object. Read-only.
end style
Returns or sets the end style for the error bars. Read/write.
Can be one of the following:
cap
no cap
name
Returns the name of the object. Read-only.
Class: floor
Plural
floors
Represents the floor of a 3-D chart
Use the floor object property to return the floor object. The following example sets the floor color for
the active chart to red. The example will fail if the chart isn't a 3-D chart.
set color index of interior object of floor object of active chart to 3
Chart Suite
418
Properties
border
Returns a border object that represents the border of the floor. Read-only.
chart fill format object
Returns a chart fill format object that contains fill formatting properties for the floor. Read-
only.
interior object
Returns an interior object that represents the interior of the floor. Read-only.
name
Returns the name of the floor. Read-only.
picture type
Returns or sets the way pictures are displayed on the floor of a 3-D chart. Read/write.
Can be one of the following:
Value Meaning
chart picture type
stretch
Stretch the picture to reach the necessary value.
chart picture type
stack
Stack the pictures to reach the necessary value.
chart picture type
stack scale
Stack the pictures, but use the picture unit property to determine what
unit each picture represents.
Class: gridlines
Represents major or minor gridlines on a chart axis. Gridlines extend the tick marks on a chart axis
to make it easier to see the values associated with the data markers.
There's no object that represents a single gridline; all gridlines for an axis are either turned on or off.
Use the major gridlines property to return the gridlines object that represents the major gridlines for
the axis. Use the minor gridlines property to return the gridlines object that represents the minor
gridlines. It's possible to return both major and minor gridlines at the same time.
The following example turns on major gridlines for the category axis on the active chart sheet.
set has major gridlines of (get axis active chart axis type value axis) to true
Properties
border
Returns a border object that represents the border of the object. Read-only.
name
Returns the name of the object. Read-only.
Chart Suite
419
Class: hilo lines
Represents the high-low lines in a chart group. High-low lines connect the highest point with the
lowest point in every category in the chart group. Only 2-D line groups can have high-low lines.
There is no object that represents a single high-low line; high-low lines are either turned on or off for
all points in a chart group.
Use the hilo lines object property to return the hilo lines object. The following example creates high-
low lines on the active chart and then makes the high-low lines blue.
set has hi lo lines of chart group 1 of active chart to true
set color index of interior object of hilo lines of active chart to 32
If the has hi lo lines property is false, most properties of the hilo lines object are disabled.
Properties
border
Returns a border object that represents the border of the object. Read-only.
name
Returns the name of the object. Read-only.
Class: interior
Plural
interiors
Represents the interior of an object.
Use the interior object property to return the interior object. The following example sets the interior
color of the floor of a chart to red.
set color index of interior object of floor object of active chart to 3
Properties
color
Returns or sets the cell shading color or the drawing object fill color as an RGB value.
Read/write.
Chart Suite
420
color index
Returns or sets the color of the interior fill. The color is specified as an index value into the
current color palette. You can also use color index none to specify that you don't want an
interior fill, or use color index automatic to specify the automatic fill (for drawing objects).
This property specifies a color as an index into the workbook color palette. The following
illustration shows the color-index values in the default color palette.
invert if negative
True if Excel inverts the pattern in the item when it corresponds to a negative number.
Read/write.
pattern
Returns or sets the interior pattern. Read/write.
Can be one of the following:
pattern automatic
pattern checker
pattern criss cross
pattern down
pattern gray 16
pattern gray 25
pattern gray 50
pattern gray 75
pattern gray 8
pattern grid
pattern horizontal
pattern light down
pattern light horizontal
pattern light up
pattern light vertical
pattern none
pattern semi gray 75
pattern solid
pattern up
pattern vertical
pattern color
Returns or sets the color of the interior pattern as an RGB value. Read/write.
pattern color index
Returns or sets the color of the interior pattern as an index into the current color palette. You
can also use color index automatic to specify the automatic pattern for cells or the automatic
fill style for drawing objects, or use color index none to specify that you don't want a pattern
(this is the same as setting the pattern property to pattern none). Read/write.
For the color-index values in the default color palette, see the color index property.
Chart Suite
421
Class: leader lines
Represents leader lines on a chart. Leader lines connect data labels to data points.
Use the leader lines property to return the leader lines object. The following example adds data
labels and leader lines to the chart.
apply data labels active chart with has leader lines
Properties
border
Returns a border object that represents the border of the object. Read-only.
Class: legend
Plural
legends
Elements
legend entry
Represents the legend in a chart. Each chart can have only one legend. The legend object contains
one or more legend entry objects; each legend entry object contains a legend key object.
Use the legend object property to return the legend object. The following example sets the font style
for the legend in the active chart to bold.
set bold of font object of legend object of active chart to true
The chart legend is not visible unless the has legend property is true. If this property is false,
properties of the legend object will fail.
Properties
auto scale font
True if the text in the legend changes font size when the legend size changes. The default
value is true. Read/write.
border
Returns a border object that represents the border of the legend. Read-only.
chart fill format object
Returns a chart fill format object that contains fill formatting properties for the legend. Read-
only.
font object
Returns a font object that represents the font of the legend. Read-only.
height
Returns or sets the height (in points) of the legend. Read/write.
interior object
Returns an interior object that represents the interior of the legend. Read-only.
Chart Suite
422
left position
Returns or sets the position (in points) of the legend. Read/write.
name
Returns the name of the legend. Read-only.
position
Returns or sets the position of the legend. Read/write.
Can be one of the following:
legend position bottom
legend position corner
legend position left
legend position right
legend position top
shadow
True if the font is a shadow font or if the legend has a shadow. Read/write.
top
Returns or sets the distance (in points) from the top edge of the legend to the top of the chart
area. Read/write.
width
Returns or sets the width of the legend. Read/write.
Class: legend entry
Plural
legend entries
Represents a legend entry in a chart legend.
Each legend entry has two parts: the text of the entry, which is the name of the series associated
with the legend entry; and an entry marker, which visually links the legend entry with its associated
series or trendline in the chart. Formatting properties for the entry marker and its associated series
or trendline are contained in the legend key object.
The text of a legend entry cannot be changed. All legend entry objects support font formatting, and
they can be deleted. No pattern formatting is supported for legend entries. The position and size of
entries is fixed.
Use legend entry index, where index is the legend entry index number, to return a single legend
entry object. You cannot return legend entries by name.
Chart Suite
423
The index number represents the position of the legend entry in the legend.
legend entry 1 is at
the top of the legend, and
legend entry (get count of legend entries) is at the bottom. The
following example changes the font for the text of the legend entry at the top of the legend (this is
usually the legend for series one) in a chart.
set italic of font object of legend entry 1 of legend object of active chart to
true
There is no direct way to return the series or trendline corresponding to the legend entry.
After legend entries have been deleted, the only way to restore them is to remove and recreate the
legend that contained them by setting the has legend property for the chart to false and then back to
true.
Properties
auto scale font
True if the text in the legend entry changes font size when the legend entry size changes. The
default value is true. Read/write.
entry index
Returns the index number of the object within the elements of the parent object. Read-only.
font object
Returns a font object that represents the font of the legend entry. Read-only.
height
Returns the height of the object. Read-only.
left position
Returns or sets the position (in points) of the legend entry. Read/write.
legend key
Returns a legend key object that represents the legend key associated with the entry. Read-
only.
top
Returns or sets the distance (in points) from the top edge of the legend entry to the top of the
chart area. Read/write.
width
Returns the width of the object. Read-only.
Class: legend key
Plural
legend keys
Represents a legend key in a chart legend. Each legend key is a graphic that visually links a legend
entry with its associated series or trendline in the chart. The legend key is linked to its associated
series or trendline in such a way that changing the formatting of one simultaneously changes the
formatting of the other.
Chart Suite
424
Use the legend key property to return the legend key object. The following example changes the
marker background color for the legend entry at the top of the legend for the active chart. This
simultaneously changes the format of every point in the series associated with this legend entry. The
associated series must support data markers.
set color index of interior object of legend key of legend entry 1 ¬
of legend object of active chart to 5
Properties
border
Returns a border object that represents the border of the legend key. Read-only.
chart fill format object
Returns a chart fill format object that contains fill formatting properties for the legend key.
Read-only.
height
Returns the height of the legend key. Read-only.
interior object
Returns an interior object that represents the interior of the legend key. Read-only.
invert if negative
True if Excel inverts the pattern in the item when it corresponds to a negative number.
Read/write.
left position
Returns or sets the position (in points) of the legend key. Read/write.
marker background color
Returns or sets the marker background color as an RGB value. Applies only to line, scatter,
and radar charts. Read/write.
marker background color index
Returns or sets the marker background color as an index into the current color palette, or as
color index automatic or color index none. Applies only to line, scatter, and radar charts.
Read/write.
The following illustration shows the color-index values in the default color palette.
Chart Suite
425
marker foreground color
Returns or sets the foreground color of the marker as an RGB value. Applies only to line,
scatter, and radar charts. Read/write.
marker foreground color index
Returns or sets the marker foreground color as an index into the current color palette, or as
color index automatic or color index none. Applies only to line, scatter, and radar charts.
Read/write.
See marker background color index for the color-index values in the default color palette.
marker size
Returns or sets the data-marker size, in points. Read/write.
marker style
Returns or sets the marker style for a point or series in a line chart, scatter chart, or radar chart.
Read/write.
Can be one of the following:
Constant Description
marker style none
No markers
marker style automatic
Automatic markers
marker style square
Square markers
marker style diamond
Diamond-shaped markers
marker style triangle
Triangular markers
marker style x
Square markers with an X
marker style star
Square markers with an asterisk
marker style dot
Short bar markers
marker style dash
Long bar markers
marker style circle
Circular markers
marker style plus
Square markers with a plus sign
marker style picture
Picture markers
Chart Suite
426
picture type
Returns or sets the way pictures are displayed on a column or bar picture chart or on the walls
and faces of a 3-D chart. Read/write.
Can be one of the following:
Value Meaning
chart picture type stretch
Stretch the picture to reach the necessary value.
chart picture type stack
Stack the pictures to reach the necessary value.
chart picture type stack scale
Stack the pictures, but use the picture unit property to
determine what unit each picture represents.
picture unit
Returns or sets the unit for each picture on the chart if the picture type property is set to chart
picture type stack scale. If not, this property is ignored. Read/write.
shadow
True if the object has a shadow. Read/write.
smooth
True if curve smoothing is turned on for the line chart or scatter chart. Applies only to line and
scatter charts. Read/write.
top
Returns or sets the distance (in points) from the top edge of the legend key to the top of the
chart area. Read/write.
width
Returns the width of the legend key. Read-only.
Class: line group
Plural
line groups
Represents one or more series plotted in a line chart. A chart contains one or more chart groups,
each chart group contains one or more series, and each series contains one or more points. For
example, a single chart might contain both a line chart group, containing all the series plotted with
the line chart format, and a doughnut chart group, containing all the series plotted with the
doughnut chart format.
Use line group index, where index is the chart-group index number, to return a single line group
object. The following example adds drop lines to line group 1 on the active chart.
set has drop lines of line group 1 of active chart to true
Properties
<Inheritance> chart group
Inherits the properties and elements of the chart group class.
Chart Suite
427
Class: pie group
Plural
pie groups
Represents one or more series plotted in a pie chart. A chart contains one or more chart groups, each
chart group contains one or more series, and each series contains one or more points. For example, a
single chart might contain both a line chart group, containing all the series plotted with the line
chart format, and a pie chart group, containing all the series plotted with the pie chart format.
Use pie group index, where index is the chart-group index number, to return a single pie group
object. The following example adds drop lines to pie group 1 on chart 1.
set has drop lines of pie group 1 of chart 1 to true
Properties
<Inheritance> chart group
Inherits the properties and elements of the chart group class.
Class: plot area
Plural
plot areas
Represents the plot area of a chart. This is the area where your chart data is plotted. The plot area on
a 2-D chart contains the data markers, gridlines, data labels, trendlines, and optional chart items
placed in the chart area. The plot area on a 3-D chart contains all of the above items plus the walls,
floor, axes, axis titles, and tick-mark labels in the chart.
The plot area is surrounded by the chart area. The chart area on a 2-D chart contains the axes, the
chart title, the axis titles, and the legend. The chart area on a 3-D chart contains the chart title and
the legend. For information about formatting the chart area, see the chart area class.
Use the plot area object property to return a plot area object. The following example sets the color of
the plot area to red.
set color index of interior object of plot area object of active chart to 3
Properties
border
Returns a border object that represents the border of the object. Read-only.
chart fill format object
Returns a chart fill format object that contains fill formatting properties for the specified chart
or shape. Read-only.
Chart Suite
428
height
Returns the height (in points) of the object. Read-only.
inside height
Returns the inside height (in points) of the plot area. Read-only.
The plot area used for this measurement does not include the axis labels. The height property
for the plot area uses the bounding rectangle that includes the axis labels.
inside left
Returns the distance (in points) from the chart edge to the inside left edge of the plot area.
Read-only.
The plot area used for this measurement does not include the axis labels. The left position
property for the plot area uses the bounding rectangle that includes the axis labels.
inside top
Returns the distance (in points) from the chart edge to the inside top edge of the plot area.
Read-only.
The plot area used for this measurement does not include the axis labels. The top property for
the plot area uses the bounding rectangle that includes the axis labels.
inside width
Returns the inside width (in points) of the plot area. Read-only.
The plot area used for this measurement does not include the axis labels. The width property
for the plot area uses the bounding rectangle that includes the axis labels.
interior object
Returns an interior object that represents the interior of the specified object. Read-only.
left position
Returns or sets the position (in points) of the specified object. Read/write.
name
Returns the name of the object. Read-only.
top
Returns or sets the distance (in points) from the top edge of the plot area to the top of the
worksheet. Read/write.
width
Returns the width of the object. Read-only.
Chart Suite
429
Class: radar group
Plural
radar groups
Represents one or more series plotted in a radar chart. A chart contains one or more chart groups,
each chart group contains one or more series, and each series contains one or more points. For
example, a single chart might contain both a line chart group, containing all the series plotted with
the line chart format, and a radar chart group, containing all the series plotted with the radar chart
format.
Use radar group index, where index is the chart-group index number, to return a single radar group
object. The following example adds drop lines to radar group 1 of the active chart.
set has drop lines of radar group 1 of active chart to true
Properties
<Inheritance> chart group
Inherits the properties and elements of the chart group class.
Class: series
Plural
series collection
Elements
data label
series point
trendline
Represents a series in a chart.
Use series index, where index is the series index number or name, to return a single series object. The
following example sets the color of the interior for the first series in a chart.
set color index of interior object of series 1 of active chart to 43
The series index number indicates the order in which the series were added to the chart.
series 1
is the first series added to the chart, and
series (get count of series collection) is the last
one added.
Chart Suite
430
Properties
apply picture to end
True if a picture is applied to the end of the point or all points in the series. Read/write.
apply picture to front
True if a picture is applied to the front of the point or all points in the series. Read/write.
apply picture to sides
True if a picture is applied to the sides of the point or all points in the series. Read/write.
axis group
Returns the group for the specified series. Read/write.
Can be one of the following:
primary axis
secondary axis
For 3-D charts, only primary axis is valid.
bar shape
Returns or sets the shape used with the 3-D bar or column chart. Read/write.
Can be one of the following:
box
pyramid to point
pyramid to max
cylinder
cone to point
cone to max
border
Returns a border object that represents the border of the object. Read-only.
bubble sizes
Returns or sets a string in A1-style notation that refers to the worksheet cells containing the
size data for the bubble chart. Applies only to bubble charts. Read/write.
chart fill format object
Returns a chart fill format object that contains fill formatting properties for the specified chart
or shape. Read-only.
Chart Suite
431
chart type
Returns or sets the chart type. Read/write.
Can be one of the following:
column clustered
column stacked
column stacked 100
ThreeD column clustered
ThreeD column stacked
ThreeD column stacked 100
bar clustered
bar stacked
bar stacked 100
ThreeD bar clustered
ThreeD bar stacked
ThreeD bar stacked 100
line stacked
line stacked 100
line markers
line markers stacked
line markers stacked 100
pie of pie
pie exploded
ThreeD pie exploded
bar of pie
xy scatter smooth
xy scatter smooth no markers
xy scatter lines
xy scatter lines no markers
area stacked
area stacked 100
ThreeD area stacked
ThreeD area stacked 100
doughnut exploded
radar markers
radar filled
surface
surface wireframe
surface top view
surface top view wireframe
bubble
bubble ThreeD effectstock HLC
stock OHLC
stock VHLC
stock VOHLC
cylinder column clustered
cylinder column stacked
cylinder column stacked 100
cylinder bar clustered
cylinder bar stacked
cylinder bar stacked 100
cylinder column
cone column clustered
cone column stacked
cone column stacked 100
cone bar clustered
cone bar stacked
cone bar stacked 100
cone col
pyramid column clustered
pyramid column stacked
pyramid column stacked 100
pyramid bar clustered
pyramid bar stacked
pyramid bar stacked 100
pyramid column
ThreeD column
line chart
ThreeD line
ThreeD pie
pie chart
xyscatter
ThreeD area
area chart
doughnut
radar
error bars
Returns an error bars object that represents the error bars for the series. Read-only.
explosion
Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if
there is no explosion (the tip of the slice is in the center of the pie). Read/write.
Chart Suite
432
formula
Returns or sets the object's formula in A1-style notation. Read/write.
formula local
Returns or sets the formula for the object, using A1-style references in the language of the user.
Read/write.
formula r1c1
Returns or sets the formula for the object using R1C1-style notation. Read/write.
formula r1c1 local
Returns or sets the formula for the object, using R1C1-style notation in the language of the
user. Read/write.
has data labels
True if the series has data labels. Read/write.
has error bars
True if the series has error bars. This property is not available for 3-D charts. Read/write.
has leader lines
True if the series has leader lines. Read/write.
has threeD effect
True if the series has a three-dimensional appearance. Applies only to bubble charts.
Read/write.
interior object
Returns an interior object that represents the interior of the series. Read-only.
invert if negative
True if Excel inverts the pattern in the item when it corresponds to a negative number.
Read/write.
leader lines
Returns a leader lines object that represents the leader lines for the series. Read-only.
marker background color
Returns or sets the marker background color as an RGB value. Applies only to line, scatter,
and radar charts. Read/write.
Chart Suite
433
marker background color index
Returns or sets the marker background color as an index into the current color palette, or as
color index automatic or color index none. Applies only to line, scatter, and radar charts.
Read/write.
The following illustration shows the color-index values in the default color palette.
marker foreground color
Returns or sets the foreground color of the marker as an RGB value. Applies only to line,
scatter, and radar charts. Read/write.
marker foreground color index
Returns or sets the marker foreground color as an index into the current color palette, or as
color index automatic or color index none. Applies only to line, scatter, and radar charts.
Read/write.
For the color-index values in the default color palette, see the marker background color index
property.
marker size
Returns or sets the data-marker size, in points. Read/write.
marker style
Returns or sets the marker style for a point or series in a line chart, scatter chart, or radar chart.
Read/write.
Can be one of the following:
marker style none
marker style automatic
marker style square
marker style diamond
marker style triangle
marker style x
marker style star
marker style dot
marker style dash
marker style circle
marker style plus
marker style picture
Chart Suite
434
picture type
Returns or sets the way pictures are displayed on a column or bar picture chart or on the walls
and faces of a 3-D chart. Read/write.
Can be one of the following:
Value Meaning
chart picture type stretch
Stretch the picture to reach the necessary value.
chart picture type stack
Stack the pictures to reach the necessary value.
chart picture type stack scale
Stack the pictures, but use the picture unit property to
determine what unit each picture represents.
picture unit
Returns or sets the unit for each picture on the chart if the picture type property is set to chart
picture type stack scale. If not, this property is ignored. Read/write.
plot order
Returns or sets the plot order for the selected series within the chart group. Read/write.
You can set plot order only within a chart group (you cannot set the plot order for the entire
chart if you have more than one chart type). Changing the plot order of one series causes the
plot orders of the other series in the chart group to be adjusted, as necessary.
series values
Returns or sets a collection of all the values in the series. Read/write.
This can be a range on a worksheet or a list of constant values, but not a combination of both.
It can also be any of the following:
range object
A1-style range reference
named range
list of category names
shadow
True if the object has a shadow. Read/write.
smooth
True if curve smoothing is turned on for the line chart or scatter chart. Applies only to line and
scatter charts. Read/write.
Chart Suite
435
xvalues
Returns or sets a list of x values for a chart series. Read/write.
The xvalues property can be set to a range on a worksheet or to a list of values, but it cannot be
a combination of both. It can also be any of the following:
range object
A1-style range reference
named range
list of category names
Class: series lines
Represents series lines in a chart group. Series lines connect the data values from each series. Only
2-D stacked bar or column chart groups can have series lines. There is no object that represents a
single series line; series lines are either turned on or off for all points in a chart group.
Use the series lines object property to return a series lines object. The following example adds series
lines to chart group 1 in the active chart (the chart must be a 2-D stacked bar or column chart).
set has series lines of chart group 1 of active chart to true
If the has series lines property is false, most properties of the series lines object are disabled.
Properties
border
Returns a border object that represents the border of the object. Read-only.
name
Returns the name of the object. Read-only.
Chart Suite
436
Class: series point
Plural
series points
Represents a single point in a series in a chart.
Use series point index, where index is the point index number, to return a single series point object.
Points are numbered from left to right on the series.
series point 1 is the leftmost point, and
series point (get count of series points) is the rightmost point. The following example
sets the marker style for the third point in series 1 in the active chart. The specified series must be a
2-D line, scatter, or radar series.
set marker style of series point 3 of series 1 ¬
of active chart to marker style diamond
Properties
apply pict to end
True if a picture is applied to the end of the point or all points in the series. Read/write.
apply pict to front
True if a picture is applied to the front of the point or all points in the series. Read/write.
apply pict to sides
True if a picture is applied to the sides of the point or all points in the series. Read/write.
border
Returns a border object that represents the border of the object. Read-only.
chart fill format object
Returns a chart fill format object that contains fill formatting properties for the specified chart
or shape. Read-only.
data label object
Returns a data label object that represents the data label associated with the point or trendline.
Read-only.
explosion
Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if
there is no explosion (the tip of the slice is in the center of the pie). Read/write.
has data label
True if the point has a data label. Read/write.
interior object
Returns an interior object that represents the interior of the specified object. Read-only.
invert if negative
True if Excel inverts the pattern in the item when it corresponds to a negative number.
Read/write.
Chart Suite
437
marker background color
Returns or sets the marker background color as an RGB value. Applies only to line, scatter,
and radar charts. Read/write.
marker background color index
Returns or sets the marker background color as an index into the current color palette, or as
color index automatic or color index none. Applies only to line, scatter, and radar charts.
Read/write.
The following illustration shows the color-index values in the default color palette.
marker foreground color
Returns or sets the foreground color of the marker as an RGB value. Applies only to line,
scatter, and radar charts. Read/write.
marker foreground color index
Returns or sets the marker foreground color as an index into the current color palette, or as
color index automatic or color index none. Applies only to line, scatter, and radar charts.
Read/write.
For the color-index values in the default color palette, see the marker background color index
property.
marker size
Returns or sets the data-marker size, in points. Read/write.
marker style
Returns or sets the marker style for a point or series in a line chart, scatter chart, or radar chart.
Read/write.
Can be one of the following:
marker style none
marker style automatic
marker style square
marker style diamond
marker style triangle
marker style x
marker style star
marker style dot
marker style dash
marker style circle
marker style plus
marker style picture
Chart Suite
438
picture type
Returns or sets the way pictures are displayed on a column or bar picture chart or on the walls
and faces of a 3-D chart. Read/write.
Can be one of the following:
Value Meaning
chart picture type stretch
Stretch the picture to reach the necessary value.
chart picture type stack
Stack the pictures to reach the necessary value.
chart picture type stack scale
Stack the pictures, but use the picture unit property to
determine what unit each picture represents.
picture unit
Returns or sets the unit for each picture on the chart if the picture type property is set to chart
picture type stack scale. If not, this property is ignored. Read/write.
secondary plot
True if the point is in the secondary section of either a pie-of-pie chart or a bar-of-pie chart.
Applies only to points on pie-of-pie charts or bar-of-pie charts. Read/write.
shadow
True if the object has a shadow. Read/write.
Class: tick labels
Represents the tick-mark labels associated with tick marks on a chart axis. There is no object that
represents a single tick-mark label; you must return all the tick-mark labels as a unit.
Tick-mark label text for the category axis comes from the name of the associated category in the
chart. The default tick-mark label text for the category axis is the number that indicates the position
of the category relative to the left end of this axis. To change the number of unlabeled tick marks
between tick-mark labels, you must change the tick label spacing property for the category axis.
Tick-mark label text for the value axis is calculated based on the major unit, minimum scale, and
maximum scale properties of the value axis. To change the tick-mark label text for the value axis, you
must change the values of these properties.
Use the tick labels property to return the tick labels object. The following example sets the
orientation of the tick labels on a chart.
set orientation of tick labels of (get axis active chart ¬
axis type category axis) to tick label orientation downward
Properties
auto scale font
True if the text in the tick labels changes font size when the tick labels size changes. The
default value is true. Read/write.
depth
Returns the number of levels of category tick labels. Read-only.
Chart Suite
439
font object
Returns a font object that represents the font of the object. Read-only.
name
Returns the name of the object. Read-only.
number format
Returns or sets the format code for the tick labels. Read/write.
You'll find a list of format codes under the Custom category on the Number tab in the Format
Cells dialog box.
number format linked
True if the number format is linked to the cells (so that the number format changes in the
labels when it changes in the cells). Read/write.
offset
Returns or sets the distance between the levels of labels, and the distance between the first
level and the axis line. The default distance is 100 percent, which represents the default
spacing between the axis labels and the axis line. The value can be an integer percentage from
0 through 1000, relative to the axis label’s font size. Read/write.
orientation
Returns or sets the tick label's orientation. Read/write.
Can be one of the following:
orientation down
orientation horizontal
orientation upward
orientation vertical
Can also be a number value between -90 and 90 degrees.
reading order
Returns or sets the reading order for the tick label. Read/write.
This property is not used in the U.S. English version of Excel.
tick alignment
Returns or sets the alignment for the specified tick label. Read/write.
Can be one of the following:
align tick label center
align tick label left
align tick label right
Chart Suite
440
Class: trendline
Plural
trendlines
Represents a trendline in a chart. A trendline shows the trend, or direction, of data in a series.
Use trendline index, where index is the trendline index number, to return a single trendline object.
The following example changes the trendline type for the first series in a chart. If the series has no
trendline, this example will fail.
set trendline type of trendline 1 of series 1 ¬
of active chart to polynomial
The index number denotes the order in which the trendlines were added to the series.
trendline 1
is the first trendline added to the series, and
trendline (get count of trendlines) is the last
one added.
Properties
backward
Returns or sets the number of periods (or units on a scatter chart) that the trendline extends
backward. Read/write.
border
Returns a border object that represents the border of the object. Read-only.
data label object
Returns a data label object that represents the data label associated with the point or trendline.
Read-only.
display R squared
True if the R-squared value of the trendline is displayed on the chart (in the same data label as
the equation). Setting this property to true automatically turns on data labels. Read/write.
display equation
True if the equation for the trendline is displayed on the chart (in the same data label as the R-
squared value). Setting this property to true automatically turns on data labels. Read/write.
entry index
Returns the index number of the object within the elements of the parent object. Read-only.
forward
Returns or sets the number of periods (or units on a scatter chart) that the trendline extends
forward. Read/write.
intercept
Returns or sets the point where the trendline crosses the value axis. Read/write.
Setting this property sets the intercept is auto property to false.
Chart Suite
441
intercept is auto
True if the point where the trendline crosses the value axis is automatically determined by the
regression. Read/write.
Setting the intercept property sets this property to false.
name
Returns or sets the name of the trendline. Read/write.
name is auto
True if Excel automatically determines the name of the trendline. Read/write.
order
Returns or sets the trendline order (an integer greater than 1) when the trendline type property
is polynomial. Read/write.
period
Returns or sets the period for the moving-average trendline. Read/write.
trendline type
Returns or sets the trendline type. Read/write.
Can be one of the following:
exponential
linear
logarithmic
moving average
polynomial
power
Class: up bars
Represents the up bars in a chart group. Up bars connect points on series one with higher values on
the last series in the chart group (the lines go up from series one). Only 2-D line groups that contain
at least two series can have up bars. There is no object that represents a single up bar; up bars must
be either turned on or off for all points in a chart group.
Use the up bars object property to return the up bars object. The following example turns on up and
down bars for chart group 1 in a chart.
set has up down bars of chart group 1 of active chart to true
If the has up down bars property is false, most properties of the up bars object are disabled.
Chart Suite
442
Properties
border
Returns a border object that represents the border of the object. Read-only.
chart fill format object
Returns a chart fill format object that contains fill formatting properties for the object. Read-
only.
interior object
Returns an interior object that represents the interior of the object. Read-only.
name
Returns the name of the object. Read-only.
Class: walls
Represents the walls of a 3-D chart. There is no object that represents a single wall; you must return
all the walls as a unit.
Use the walls object property to return the walls object. The following example sets the pattern on
the walls for the active chart. If the chart is not a 3-D chart, this example will fail.
set pattern of interior object of walls object ¬
of active chart to pattern checker
Properties
border
Returns a border object that represents the border of the object. Read-only.
chart fill format object
Returns a chart fill format object that contains fill formatting properties for the object. Read-
only.
interior object
Returns an interior object that represents the interior of the object. Read-only.
name
Returns the name of the object. Read-only.
Chart Suite
443
picture type
Returns or sets the way pictures are displayed on a column or bar picture chart or on the walls
and faces of a 3-D chart. Read/write.
Can be one of the following:
Value Meaning
chart picture type stretch
Stretch the picture to reach the necessary value.
chart picture type stack
Stack the pictures to reach the necessary value.
chart picture type stack scale
Stack the pictures, but use the picture unit property to
determine what unit each picture represents.
picture unit
Returns or sets the unit for each picture on the chart if the picture type property is set to chart
picture type stack scale. If not, this property is ignored. Read/write.
Class: xy group
Plural
xy groups
Represents one or more series plotted in an xy chart. A chart contains one or more chart groups,
each chart group contains one or more series, and each series contains one or more points. For
example, a single chart might contain both a line chart group, containing all the series plotted with
the line chart format, and an xy chart group, containing all the series plotted with the xy chart
format.
Use xy group index, where index is the chart-group index number, to return a single xy group object.
The following example adds drop lines to xy group 1 on the active chart.
set has drop lines of xy group 1 of active chart to true
Properties
<Inheritance> chart group
Inherits the properties and elements of the chart group class.
.
Chart Suite
444
Chart Suite Commands
activate object (chart) ................................................................................................................................................. 444
apply custom chart type ............................................................................................................................................ 445
apply data labels......................................................................................................................................................... 445
bring to front (chart)...................................................................................................................................................445
chart location............................................................................................................................................................... 446
chart one color gradient.............................................................................................................................................446
chart patterned............................................................................................................................................................447
chart solid....................................................................................................................................................................448
chart two color gradient ............................................................................................................................................448
chart user picture........................................................................................................................................................449
chart user textured .....................................................................................................................................................449
chart wizard ................................................................................................................................................................ 449
check spelling (chart) ................................................................................................................................................. 450
clear ..............................................................................................................................................................................450
clear contents (chart)..................................................................................................................................................450
clear formats................................................................................................................................................................ 451
copy chart as picture..................................................................................................................................................451
copy object (chart) ......................................................................................................................................................451
copy picture (chart) ....................................................................................................................................................452
cut (chart)..................................................................................................................................................................... 452
deselect ........................................................................................................................................................................ 452
error bar....................................................................................................................................................................... 453
get axis ......................................................................................................................................................................... 453
get chart element ........................................................................................................................................................453
get has axis ..................................................................................................................................................................455
paste ............................................................................................................................................................................. 455
paste chart ...................................................................................................................................................................456
paste series ..................................................................................................................................................................456
preset chart gradient.................................................................................................................................................. 457
preset chart textured ..................................................................................................................................................458
print out (chart) .......................................................................................................................................................... 458
print preview (chart)..................................................................................................................................................458
protect chart ................................................................................................................................................................ 459
refresh (chart).............................................................................................................................................................. 459
save as (chart).............................................................................................................................................................. 460
send to back (chart) ....................................................................................................................................................461
set background picture (chart).................................................................................................................................. 461
set has axis................................................................................................................................................................... 461
set source data.............................................................................................................................................................462
unprotect (chart)......................................................................................................................................................... 462
Command: activate object (chart)
Activates the chart object.
Syntax
activate chart/chart object Required. An expression that returns a chart or chart object object.
Example
This example creates a new chart called Chart1 and then activates it.
set Chart1 to make new chart object at active sheet
activate object Chart1
Chart Suite
445
Command: apply custom chart type
This command is not currently supported.
Command: apply data labels
Syntax
Applies data labels to a series or all the series in a chart.
apply data labels chart Required. An expression that returns a chart object.
[type enumeration] Optional. The data label type. Can be one of the following:
Value Description
data labels show none
No data labels.
data labels show value
Value for the point (assumed if this argument isn't
specified).
data labels show percent
Percentage of the total. Available only for pie charts and
doughnut charts.
data labels show label
Category for the point. This is the default value.
data labels show label and percent
Percentage of the total, and category for the point.
Available only for pie charts and doughnut charts.
data labels show bubble sizes
On bubble charts, show bubble size.
[legend key Boolean] Optional. True to show the legend key next to the point. The default value
is false.
[auto text Boolean] Optional. True if the object automatically generates appropriate text based on content.
[has leader lines Boolean] Optional. True if the series has leader lines.
Example
This example applies category labels to series one in the active chart.
apply data labels active chart type data labels show value
Command: bring to front (chart)
Brings the chart object to the front of the z-order.
Syntax
bring to front chart object Required. An expression that returns a chart object object.
Example
This example brings Chart1 on Sheet1 to the front of the z-order.
bring to front chart object "Chart1" of worksheet "Sheet1"
Chart Suite
446
Command: chart location
Moves the chart to a new location.
Syntax
chart location chart Required. An expression that returns a chart object.
where enumeration Required. Where to move the chart. Can be one of the following: location as
new sheet, location as object, or location automatic.
[name Unicode text] Optional (Required if where is location as object). The name of the sheet where the
chart will be embedded if where is location as object or the name of the new sheet if where is location as
new sheet.
Example
This example moves the active chart to a new chart sheet named "Monthly Sales."
chart location active chart where location as new sheet name "Monthly Sales"
Command: chart one color gradient
Sets the specified fill to a one-color gradient.
Syntax
chart one color gradient chart fill format/chart title/axis title/series point/series/data
label/legend key/down bars/floor/walls/plot area/chart area/legend/display unit label
Required. An expression that returns one of the listed objects.
gradient style enumeration Required. The gradient style. Can be one of the following:
gradient unset
horizontal gradient
vertical gradient
diagonal up gradient
diagonal down gradient
from corner gradient
from title gradient (PowerPoint only)
from center gradient
variant integer Required. The gradient variant. Can be a value from 1 through 4, corresponding
to one of the four variants on the Gradient tab in the Fill Effects dialog box. If gradient style is
from center gradient, the variant argument can only be 1 or 2.
degree small real Required. The gradient degree. Can be a value from 0.0 (dark) through 1.0 (light).
Example
This example sets the fill format for series 1 of the active chart to a horizontal one-color gradient.
chart one color gradient series 1 of active chart ¬
gradient style horizontal gradient variant 3 degree 0.34
Chart Suite
447
Command: chart patterned
Sets the specified fill to a pattern.
Syntax
chart patterned chart fill format/chart title/axis title/series point/series/data label/legend
key/down bars/floor/walls/plot area/chart area/legend/display unit label Required. An
expression that returns a chart fill format object.
pattern enumeration Required. The pattern type. Can be one of the following:
pattern unset
five percent pattern
ten percent pattern
twenty percent pattern
twenty five percent pattern
thirty percent pattern
forty percent pattern
fifty percent pattern
sixty percent pattern
seventy percent pattern
seventy five percent pattern
eighty percent pattern
ninety percent pattern
dark horizontal pattern
dark vertical pattern
dark downward diagonal pattern
dark upward diagonal pattern
small checker board pattern
trellis pattern
light horizontal pattern
light vertical pattern
light downward diagonal pattern
light upward diagonal pattern
small grid pattern
dotted diamond pattern
wide downward diagonal
wide upward diagonal pattern
dashed upward diagonal pattern
dashed downward diagonal pattern
narrow vertical pattern
narrow horizontal pattern
dashed vertical pattern
dashed horizontal pattern
large confetti pattern
large grid pattern
horizontal brick pattern
large checker board pattern
small confetti pattern
zig zag pattern
solid diamond pattern
diagonal brick pattern
outlined diamond pattern
plaid pattern
sphere pattern
weave pattern
dotted grid pattern
divot pattern
shingle pattern
wave pattern
Example
This example sets the fill pattern for the plot area of the active chart.
chart patterned chart fill format object of plot area object ¬
of active chart pattern dark downward diagonal pattern
Chart Suite
448
Command: chart solid
Sets the specified fill to a uniform color. Use this command to convert a gradient, textured,
patterned, or background fill back to a solid fill.
Syntax
chart solid chart fill format/chart title/axis title/series point/series/data label/legend key/down
bars/floor/walls/plot area/chart area/legend/display unit label Required. An expression that
returns a chart fill format object.
Example
This example converts the floor of the active chart to a solid color.
chart solid chart fill format object of floor object of active chart
Command: chart two color gradient
Sets the specified fill to a two-color gradient.
Syntax
chart two color gradient chart fill format/chart title/axis title/series point/series/data
label/legend key/down bars/floor/walls/plot area/chart area/legend/display unit label
Required. An expression that returns a chart fill format object.
gradient style enumeration Required. The gradient style. Can be one of the following:
gradient unset
horizontal gradient
vertical gradient
diagonal up gradient
diagonal down gradient
from corner gradient
from title gradient (PowerPoint only)
from center gradient
variant integer Required. The gradient variant. Can be a value from 1 through 4, corresponding
to one of the four variants on the Gradient tab in the Fill Effects dialog box. If gradient style is
from center gradient, the variant argument can only be 1 or 2.
Example
This example sets the two color gradient for a series in the active chart.
chart two color gradient series 1 of active chart ¬
gradient style vertical gradient variant 3
Chart Suite
449
Command: chart user picture
Fills the specified shape with an image.
Syntax
chart user picture chart fill format/chart title/axis title/series point/series/data label/legend
key/down bars/floor/walls/plot area/chart area/legend/display unit label Required. An
expression that returns a chart fill format object.
[picture file Unicode text] Optional. The name of the picture file.
[picture format enumeration] Optional. The picture format. Can be one of the following: chart picture type
stack scale, chart picture type stack, or chart picture type stretch.
[picture stack unit integer] Optional. The picture stack or scale unit (depends on the picture format
argument).
[picture placement enumeration] Optional. The picture placement. Can be one of the following: sides, end,
end sides, front, front sides, front end, or all faces.
Example
This example sets the fill format for a series to a picture titled "brick.bmp."
chart user picture series 1 of active chart picture file "brick.bmp"
Command: chart user textured
Fills the specified shape with small tiles of an image. To fill the shape with one large image, use the
chart user picture command.
Syntax
chart user textured chart fill format/chart title/axis title/series point/series/data label/legend
key/down bars/floor/walls/plot area/chart area/legend/display unit label Required. An
expression that returns a chart fill format object.
[texture file Unicode text] Required. The name of the picture file.
Example
This example sets the fill format for the floor of the active chart to use a picture titled "brick.bmp" as
the texture.
chart user textured chart fill format object of floor object ¬
of active chart texture file "brick.bmp"
Command: chart wizard
This command is not currently supported.
Chart Suite
450
Command: check spelling (chart)
Checks the spelling of an object. This form has no return value; Excel displays the Spelling dialog
box.
Syntax
check spelling chart Required. Checks the spelling of the chart.
[custom dictionary Unicode text] Optional. A string that indicates the file name of the custom
dictionary to examine if the word isn't found in the main dictionary. If this argument is
omitted, the currently specified dictionary is used.
[ignore uppercase Boolean] Optional. True to have Excel ignore words that are all uppercase. False to have
Excel check words that are all uppercase. If this argument is omitted, the current setting will be used.
[always suggest Boolean] Optional. True to have Excel display a list of suggested alternate spellings when
an incorrect spelling is found. False to have Excel wait for you to input the correct spelling. If this
argument is omitted, the current setting will be used.
Remarks
To check headers, footers, and objects on a worksheet, use this command on a worksheet object.
To check only cells and notes, use this command on the cell object.
Example
This example checks spelling on the active chart sheet.
check spelling active chart with ignore uppercase without always suggest
Command: clear
Clears the entire chart area or legend object.
Syntax
clear chart area/legend Required. An expression that returns a chart area or legend object.
Example
This example removes the chart legend from the active chart.
clear legend object of active chart
Command: clear contents (chart)
Clears the data from a chart but leaves the formatting.
Syntax
clear contents chart area Required. An expression that returns a chart area object.
Example
This example clears the chart data from the active chart but leaves the formatting intact.
clear contents chart area object of active chart
Chart Suite
451
Command: clear formats
Clears the formatting of the chart object.
Syntax
clear formats series point/series/legend key/trendline/floor/walls/plot area/chart area/error
bars Required. An expression that returns one of the listed objects.
Example
This example clears the formatting from the first series in the active chart.
clear formats series 1 of active chart
Command: copy chart as picture
Copies the selected chart object to the Clipboard as a picture.
Syntax
copy chart as picture chart Required. An expression that returns a chart object.
[appearance enumeration] Optional. Specifies how the picture should be copied. Can be one of
the following: screen or printer. If screen is used, the picture is copied to resemble its display
on the screen as closely as possible. If printer is used, the picture is copied as it will look when
it's printed. The default value is screen.
[format enumeration] Optional. The format of the picture. Can be one of the following: picture or bitmap.
The default value is picture.
[output size enumeration] Optional. Used only with chart objects. The size of the copied picture when the
object is a chart on a chart sheet (not embedded on a worksheet). Can be one of the following: screen or
printer. If screen is used, the picture is copied to match the size of its display on the screen as closely as
possible. If printer is used, the picture is copied to match its printed size as closely as possible. The
default value is printer.
Remarks
If you copy a range, it must be made up of adjacent cells.
Example
This example copies the active chart to the Clipboard as a picture optimized for display on a screen.
copy chart as picture active chart appearance screen ¬
format picture output size screen
Command: copy object (chart)
Copies the object to the Clipboard.
Syntax
copy object chart object/series point/series/chart area Required. An expression that returns one
of the listed objects.
Example
This example copies the active chart to the Clipboard.
copy object active chart
Chart Suite
452
Command: copy picture (chart)
Copies the selected object to the Clipboard as a picture.
Syntax
copy picture chart object Required. An expression that returns a chart object object.
[appearance enumeration] Optional. Specifies how the picture should be copied. Can be one of
the following: screen or printer. If screen is used, the picture is copied to resemble its display
on the screen as closely as possible. If printer is used, the picture is copied as it will look when
it's printed. The default value is screen.
[format enumeration] Optional. The format of the picture. Can be one of the following: picture or bitmap.
The default value is picture.
Remarks
If you copy a range, it must be made up of adjacent cells.
Example
This example copies a screen image of the active chart object.
copy picture active chart appearance screen format picture
Command: cut (chart)
Cuts the object to the Clipboard or pastes it into a specified destination.
Syntax
cut chart object Required. An expression that returns a chart object object.
Only embedded charts can be cut.
Example
This example creates and then cuts the chart on the active sheet.
set ch1 to (make new chart object at active sheet)
cut ch1
Command: deselect
Cancels the selection for the specified chart.
Syntax
deselect chart Required. An expression that returns a chart object.
Example
This example is equivalent to pressing ESC while working on the active chart. The example should
be run on a chart that has a component (such as an axis) selected.
deselect active chart
Chart Suite
453
Command: error bar
This command is not currently supported.
Command: get axis
Returns an object that represents the specified axis.
Syntax
get axis chart Required. An expression that returns a chart object.
axis type enumeration Required. Specifies the axis to return. Can be one of the following:
category axis, series axis, or value axis. The series axis value is valid only for 3-D charts.
[which axis enumeration] Optional. Specifies the axis group. Can be one of the following: primary axis or
secondary axis. If this argument is omitted, the primary axis group is used. 3-D charts have only one axis
group.
Example
This example gets the category axis of the active chart.
get axis active chart axis type category axis
Command: get chart element
Returns information about the chart element at specified X and Y coordinates. This command is
unusual in that you specify values for only the first two arguments. Excel fills in the other
arguments, and your code should examine those values when the command returns.
Syntax
get chart element chart Required. An expression that returns a chart object.
x integer Required. The X coordinate of the chart element.
y integer Required. The Y coordinate of the chart element.
Returned items
element id integer Returned. When the command returns, this argument contains the value of
the chart element at the specified coordinates.
argument1 integer Returned. When the command returns, this argument contains information related to
the chart element.
argument2 integer Returned. When the command returns, this argument contains information related to
the chart element.
Chart Suite
454
The value of element id after the command returns determines whether argument1 and argument2
contain any information, as shown in the following table.
element id argument1 argument2
chart area
none none
chart title
none none
plot area
none none
legend
none none
floor
none none
walls
none none
corners
none none
data table
none none
series
series index point index
data label
series index point index
trendline
series index trendline index
error bars
series index none
x error bars
series index none
y error bars
series index none
legend entry
series index none
legend key
series index none
axis
axis index axis type
major gridlines
axis index axis type
minor gridlines
axis index axis type
axis title
axis index axis type
up bars
group index none
down bars
group index none
series lines
group index none
hilo lines
group index none
drop lines
group index none
radar axis labels
group index none
shape
shape index none
nothing
none none
Chart Suite
455
The following table describes the meaning of argument1 and argument2 after the command returns.
Argument Description
series index Specifies the offset for a specific series.
point index Specifies the offset for a specific point within a series. A value of -1 indicates that all
data points are selected.
trendline
index
Specifies the offset for a specific trendline within a series.
axis index Specifies whether the axis is primary (0) or secondary (1).
axis type Specifies the axis type: category axis (0), value axis (1), or series axis (2).
group index Specifies the offset for a specific chart group.
shape index Specifies the offset for a specific shape.
Example
This example gets the chart element at coordinate 120:120.
get chart element active chart x 120 y 120
Command: get has axis
Returns which axes exist on the chart.
Syntax
get has axis chart Required. An expression that returns a chart object.
[axis type enumeration] Optional. Specifies the axis type. Can be one of the following: category
axis, series axis, or value axis.
[axis group enumeration] Optional. Specifies the axis group. Can be one of the following: primary axis or
secondary axis.
Example
This example checks for the existence of a category axis for chart one.
get has axis active chart axis type category axis axis group primary axis
Command: paste
Pastes a floor or walls object from the Clipboard into a specified destination.
Syntax
paste floor/walls Required. An expression that returns a floor or walls object.
Example
This example pastes a floor object from the Clipboard.
paste floor object of active chart
Chart Suite
456
Command: paste chart
Pastes chart data from the Clipboard into the specified chart.
Syntax
paste chart chart Required. An expression that returns a chart object.
[format enumeration] Optional. Specifies the chart information to paste if a chart is on the
Clipboard. Can be one of the following:
paste all
paste all except borders
paste formats
paste formulas
paste comments
paste values
paste column widths
paste validation
paste formulas and number formats
paste values and number formats
The default value is paste all. If there is data other than a chart on the Clipboard, this argument
cannot be used.
This command changes the current selection.
Example
This example pastes a chart from the Clipboard.
paste chart active chart
Command: paste series
Pastes a picture from the Clipboard as the marker on the selected series.
Syntax
paste series series Required. An expression that returns a series object.
Example
This example pastes a picture from the Clipboard into series 1 in the active chart.
paste series series 1 of active chart
Chart Suite
457
Command: preset chart gradient
Sets the specified fill to a preset gradient.
Syntax
preset chart gradient chart fill format/chart title/axis title/series point/series/data label/legend
key/down bars/floor/walls/plot area/chart area/legend/display unit label Required. An
expression that returns a chart fill format object.
gradient style enumeration Required. The gradient style. Can be one of the following:
gradient unset
horizontal gradient
vertical gradient
diagonal up gradient
diagonal down gradient
from corner gradient
from title gradient (PowerPoint only)
from center gradient
variant integer Required. The gradient variant. Can be a value from 1 through 4, corresponding
to one of the four variants on the Gradient tab in the Fill Effects dialog box. If gradient style is
from center gradient, the variant argument can only be 1 or 2.
preset gradient type enumeration Required. The gradient type. Can be one of the following:
preset gradient unset
gradient early sunset
gradient late sunset
gradient nightfall
gradient daybreak
gradient horizon
gradient desert
gradient ocean
gradient calm water
gradient fire
gradient fog
gradient moss
gradient peacock
gradient wheat
gradient parchment
gradient mahogany
gradient rainbow
gradient rainbow2
gradient gold
gradient gold2
gradient brass
gradient chrome
gradient chrome2
gradient silver
gradient sapphire
Example
This example sets the gradient for the up bars of the active chart.
preset chart gradient up bars object of chart group 1 ¬
of active chart gradient style diagonal up ¬
gradient variant 3 preset gradient type gradient daybreak
Chart Suite
458
Command: preset chart textured
This command is not currently supported.
Command: print out (chart)
Prints the chart.
Syntax
print out chart Required. An expression that returns a chart object.
[from integer] Optional. The number of the page at which to start printing. If this argument is
omitted, printing starts at the beginning.
[to integer] Optional. The number of the last page to print. If this argument is omitted, printing ends with
the last page.
[copies integer] Optional. The number of copies to print. If this argument is omitted, one copy is printed.
[preview Boolean] Optional. True to have Excel invoke print preview before printing the object. False (or
omitted) to print the object immediately.
[active printer Unicode text] Optional. This argument is not currently supported.
[print to file Boolean] Optional. This argument is not currently supported.
[collate Boolean] Optional. True to collate multiple copies.
Remarks
"Pages" in the descriptions of from and to refers to printed pages, not overall pages in the sheet or
workbook.
This command applies to the window object only when it's the Info window.
Example
This example prints the active chart sheet.
print out active sheet
Command: print preview (chart)
Shows a preview of the chart as it would look when printed.
Syntax
print preview chart Required. An expression that returns a chart object.
[enable changes Boolean] Optional. Controls access to the Page Setup dialog box and the ability
to change margins from the Print Preview window by enabling or disabling the Setup and
Margins buttons, respectively.
Chart Suite
459
Example
This example displays the active sheet in print preview.
print preview active sheet
Command: protect chart
Protects a chart so that it cannot be modified.
Syntax
protect chart chart Required. An expression that returns a chart object.
[password Unicode text] Optional. A string that specifies a case-sensitive password for the
sheet. If this argument is omitted, you can unprotect the sheet without using a password.
Otherwise, you must specify the password to unprotect the sheet. If you forget the password,
you cannot unprotect the sheet. It's a good idea to keep a list of your passwords and their
corresponding document names in a safe place.
[drawing objects Boolean] Optional. True to protect shapes. The default value is false.
[chart contents Boolean] Optional. True to protect contents. This protects the entire chart. The default value
is true.
[user interface only Boolean] Optional. True to protect the user interface, but not VB macros. If this
argument is omitted, protection applies both to VB macros and to the user interface.
Example
This example protects the active chart by setting "drowssap" as the password.
protect chart active chart password "drowssap"
Command: refresh (chart)
Updates the cache of the chart object.
Syntax
refresh chart Required. An expression that returns a chart object.
Example
This example refreshes the active chart.
refresh active chart
Chart Suite
460
Command: save as (chart)
Saves changes to a different file.
Syntax
save as chart Required. An expression that returns a chart object.
filename Unicode text Optional. A string that indicates the name of the file to be saved. You can
include a full path; if you don't, Excel saves the file in the current folder.
[file format enumeration] Optional. The file format to use when you save the file. Can be one of the
following:
add in file format
CSV file format
CSV Mac file format
CSV MSDos file format
CSV Windows file format
DBF2 file format
DBF3 file format
DBF4 file format
DIF file format
Excel2 file format
Excel 2 east asian file format
Excel3 file format
Excel4 file format
Excel 4 workbook file format
Excel7 file format
Excel 9795 file format
international add in file format
international macro file format
workbook normal file format
SYLK file format
template file format
current platform text file format
text Mac file format
text MSDos file format
text printer file format
text windows file format
WJ2WD1 file format
Works1 file format
Works 1 all file format
Works 1 fmt file format
Works3 file format
Works 3 fm 3 file format
Works4 file format
works file format
works 2 east asian file format
WQ1 file format
WJ3 file format
WJ3FJ3 file format
HTML file format
XML spreadsheet file format
The following formats are available only in the Japanese version of Excel: WJ2WD1 file format,
Excel 2 east asian file format, and works 2 east asian file format.
[password Unicode text] Optional. A case-sensitive string (no more than 15 characters) that
indicates the protection password to be given to the file.
[write reservation password Unicode text] Optional. A string that indicates the write-reservation password
for this file. If a file is saved with the password and the password isn't supplied when the file is opened,
the file is opened as read-only.
[read only recommended Boolean] Optional. True to display a message when the file is opened,
recommending that the file be opened as read-only.
[create backup Boolean] Optional. True to create a backup file.
[add to most recently used list Boolean] Optional. True to add this workbook to the list of recently used
files. The default value is false.
Chart Suite
461
Example
This example saves a chart in Excel 4 workbook format and adds a password.
save as active chart filename "saved chart" ¬
file format Excel 4 workbook file format ¬
password "password"
Command: send to back (chart)
Sends the chart object to the back of the z-order.
Syntax
send to back chart object Required. An expression that returns a chart object.
Example
This example sends the active chart to the back of the z-order.
send to back active chart
Command: set background picture (chart)
Sets the background graphic for a chart.
Syntax
set background picture chart Required. An expression that returns a chart object.
picture file name Unicode text Required. The name of the graphic file.
Example
This example sets the background graphic for the active chart.
set background picture active chart ¬
picture file name "Macintosh HD:Users:Shared:watrmark.gif"
Command: set has axis
Sets which axes exist on the chart.
Syntax
set has axis chart Required. An expression that returns a chart object.
axis exists Boolean Required. True if the specified axis should exist.
[axis type enumeration] Optional. Specifies the axis type. Can be one of the following: category axis, series
axis, or value axis.
[axis group enumeration] Optional. Specifies the axis group. Can be one of the following: primary axis or
secondary axis.
Chart Suite
462
Example
This example turns off the category axis for the chart.
set has axis active chart axis exists false axis type category axis
Command: set source data
Sets the source data range for the chart.
Syntax
set source data chart Required. An expression that returns a chart object.
source range Required. The range that contains the source data.
[plot by enumeration] Optional. Specifies the way the data is to be plotted. Can be either by columns or by
rows.
Example
This example sets the source data range for the active chart and plots by columns.
set source data active chart source range "=Sheet1!$B$1:$C$4" ¬
plot by columns
Command: unprotect (chart)
Removes protection from a chart. This command has no effect if the sheet or workbook isn't
protected.
Syntax
unprotect chart Required. An expression that returns a chart object.
[password Unicode text] Optional. A string that denotes the case-sensitive password to use to
unprotect the chart. If the chart isn't protected with a password, this argument is ignored. If
you omit this argument for a chart that's protected with a password, you'll be prompted for
the password.
Remarks
If you forget the password, you cannot unprotect the chart. It's a good idea to keep a list of your
passwords and their corresponding document names in a safe place.
Example
This example removes protection from the active chart by providing the correct password.
unprotect active chart password "drowssap"