-- XL 2004 Save As Text Mac Example
--OSX 10.4.11
--This makes 4 files in the desktop folder.
--If you run it again it fails to overwrite
set SourceFolder to path to desktop as alias
MakeAFolder("Excel Text Test", SourceFolder)
tell application "Finder"
set targetFolder to (folder "Excel Text Test" of SourceFolder) as alias
end tell
repeat with x from 1 to 4
set Excel_txt_FileName to "XL_TextFile_" & x & ".txt"
tell application "Microsoft Excel"
activate
make new workbook
delay 2 --just for ease of viewing
save in ((targetFolder as text) & Excel_txt_FileName) as text Mac file format with overwrite
delay 2 --just for ease of viewing
close active workbook without saving
end tell
end repeat
--#################### Handlers ######################
on MakeAFolder(FolderName, PathToParentFolder)
--Example call --tell me to MakeAFolder("Excel_Copy_Pgs_Printed", SourceFolder)
tell application "Finder"
if not (exists folder FolderName of PathToParentFolder) then
make new folder at PathToParentFolder with properties {name:FolderName}
end if
end tell
end MakeAFolder
--################### END Handler Routines ###############
Thanks
Oakley