Re: Bug in (scripting) Excel.
Re: Bug in (scripting) Excel.
- Subject: Re: Bug in (scripting) Excel.
- From: kai <email@hidden>
- Date: Sun, 28 Sep 2003 02:26:01 +0100
on 27/9/03 9:46 pm, Deivy Petrescu wrote:
>
So that I can clarify something if it is not clear.
>
Here is the outoput of the log window:
>
____
>
tell Application "Microsoft Excel"
>
set ScreenUpdating to false
>
current date
>
date "Saturday, September 27, 2003 16:19:15"
>
OpenText
>
"SantosFC:Users:deivy:documents:GBC:Web:Main:Fall_03_exams.xls"
>
true
>
OpenText
>
"SantosFC:Users:deivy:documents:GBC:Web:Main:Fall_03_quizzes.xls"
>
true
>
OpenText
>
"SantosFC:Users:deivy:documents:GBC:Web:Main:Fall_03_attendance.xls"
>
true
>
Activate Workbook "Fall_03_exams.xls" --> Active workbook
>
true
>
Select Sheet 1
>
true
>
get Name of Sheet 1
>
"298DA"
>
Select Range "R2C2"
>
true
>
LastCell Range "R2C2" Direction xlDown
>
Range "R8C2" of Worksheet "298DA" of Workbook
>
"Fall_03_attendance.xls" -->It was never brought to front, the last
>
-->WB opened
>
by me.
>
get Row of Range "R8C2" of Worksheet "298DA" of Workbook
>
"Fall_03_attendance.xls" --> This should be exams!!!
>
8
>
>
____
>
Can you clarify that?
>
Are you saying that if you open more than one Workbook it works when
>
try to get a range?
>
I've tried Activate W(hatever) and the behaviour is always the same. It
>
reads the range of the last name of my list of names.
>
Do you get a different behaviour here?
>
If so, can we share the codes and see what is different?
>
>
Here
>
10.2.8 (is this my problem?)
>
AppleScript 1.9.1
>
S.E. 2.0 (v36)
>
Excel X for Mac Service Release 1
Sorry about the delay. I was elsewhere...
Right. I'm on an older machine at the moment, so we have quite a few
differences: OS 9.1 / AS 1.8.3 / SE 1.8.3 / Excel 98.
To test this situation, I set up a folder on the desktop named "Excel Tests"
Inside this, I placed 3 Excel workbook files: "xlTest1", "xlTest2" and
"xlTest3".
I also placed data in each workbook - but in different columns:
"xlTest1": worksheet 1, row 1, column 4
"xlTest2": worksheet 1, row 1, column 5
"xlTest3": worksheet 1, row 1, column 6
I then ran this short test script:
-----------------------------------------------------
set xlFold to "Hard Disk:Desktop Folder:Excel Tests:"
set {n1, n2, n3} to {"xlTest1", "xlTest2", "xlTest3"}
tell application "Microsoft Excel"
repeat with w in {n1, n2, n3}
Open (xlFold & w)
end repeat
Activate Window n1
set lastcolumn to Column of (LastCell of Range "A1" Direction xlToRight)
end tell
-----------------------------------------------------
Output from the log window:
-----------------------------------------------------
tell Application "Microsoft Excel"
Open "Hard Disk:Desktop Folder:Excel Tests:xlTest1"
--> Workbook "xlTest1"
Open "Hard Disk:Desktop Folder:Excel Tests:xlTest2"
--> Workbook "xlTest2"
Open "Hard Disk:Desktop Folder:Excel Tests:xlTest3"
--> Workbook "xlTest3"
Activate Window "xlTest1"
--> true
LastCell Range "A1" Direction xlToRight
--> Range "R1C4" of Worksheet "Sheet1" of Workbook "xlTest1"
get Column of Range "R1C4" of Worksheet "Sheet1" of Workbook "xlTest1"
--> 4
end tell
-----------------------------------------------------
From your results, it looks like the activate command fails (even though
Excel returns a value of true.) Which Excel window physically ends up in
front?
Since my older configuration appears to work as expected, it seems a bug may
have crept in somewhere. I couldn't say for sure where this might be - but
I'd probably start looking at Excel X for Mac.
HTH
---
kai
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.