Excel problems switching between documents
Excel problems switching between documents
- Subject: Excel problems switching between documents
- From: Max Bonilla <email@hidden>
- Date: Fri, 27 Apr 2007 15:22:33 -0400
- Thread-topic: Excel problems switching between documents
Title: Excel problems switching between documents
Hello everyone,
I’ve converted an Excel X script to Excel 2004 to be able to compare information across two large spreadsheets. For some reason despite my trying to call the spreadsheet (activate), Excel reads the front-most window without regard to my references.
A portion of the script reads:
tell application "Microsoft Excel"
repeat with i from 25 to 123
tell workbook "FUSMay3CostAnalysis(3).xls"
tell worksheet 1
activate
set MidX to "Y" & i as string
set MidV to value of range MidX
set MidV to MidV as integer
end tell
end tell
end repeat
end tell
I also tried referring to the spreadsheet thus,
tell application "Microsoft Excel"
repeat with i from 25 to 123
set MidX to "Y" & i as string
set MidV to value of range MidX of worksheet 1 of workbook "FUSMay3CostAnalysis(3).xls"
set MidV to MidV as integer
end tell
end tell
end repeat
end tell
In either case, I get erratic results. Sometimes the script reads the right spreadsheet. Other times it does not. The script is never able to move one window to the front (activate). Of course, I’m not interested in bringing the window to the front. What I want is to extract the information from the correct spreadsheet and be sure that I’m getting the expected result (each of the two spreadsheets has over 4600 cells). I also tried referring to the workbook alternatively as window or document, but nothing changed.
I would appreciate some insight.
Thanks.
Max
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden