Having some trouble activating and then writing to a sheet within a workbook. I am using Office 2008. here is what I have so far and the error message is activate object worksheet {"Room 218"}
"Microsoft Excel got an error: The object you are trying to access does not exist" The worksheet Room 218
does exist and is the second worksheet. I know there is a feature to access the index number of the worksheet, but that seems way more complicated than just using the name of the worksheet since I have that info right at hand.
Thanks,
dan
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #FFDDFF;
overflow: auto;"
title="this text can be pasted into the Script Editor">
set a to text returned of (display dialog "Please enter the slot (A-H) and the room #, separating them with a comma:" default answer "")
,set astid to AppleScript's text item delimiters
,set AppleScript's text item delimiters to ","
,set {chosenslot, chosenroom} to {(a's text item 1), (a's text item 2)}
,set AppleScript's text item delimiters to astid
,tell application "Microsoft Excel"
, activate
, open workbook workbook file name "MacBook HD:Users:Dano:Desktop:Classrooms.xlsx"
, activate object workbook "Classrooms.xlsx"
, set worksheetname to {"Room " & chosenroom}
, activate object worksheet worksheetname
, set formula of range "J3" of worksheet worksheetname to chosenslot
,end tell,</pre>