Re: Bug in (scripting) Excel.
Re: Bug in (scripting) Excel.
- Subject: Re: Bug in (scripting) Excel.
- From: Deivy Petrescu <email@hidden>
- Date: Sun, 28 Sep 2003 10:38:08 -0400
On Sunday, Sep 28, 2003, at 00:52 US/Eastern, Paul Berkowitz wrote:
The trick to understanding Excel AppleScript terms is to look up their
equivalent in the VBA Help.
I don't seem to be able to copy and paste from the Help so you'll have
to
look it up yourself. basically, it's designed to run code and
calculations
faster by _not_ displaying them on the screen. Therefore it does stand
to
reason that it's going to ignore any commands - like Activate - which
specifically relate to screen display, no?
--
Paul Berkowitz
This is basically my question.
The main problem I see is that all the other ways to target a window,
workbook or worksheet in excel do not work (such as select and tell)
Besides, excel returns a true for the activate command. So my belief is
that it is active "in front", but the screen is not redrawn.
But may be my understanding is wrong.
Update, if I use :
tell application "Microsoft Excel"
set ScreenUpdating to false
Activate
Excel comes to front, but there is no window in the screen.
My point is not argue but to really understand and possibly offer
suggestions to MS.
If I could use AW I would, but scripting AW is such a pain that I'll
not be complaining about excel.
On Sunday, Sep 28, 2003, at 01:56 US/Eastern, David Wignall wrote:
<snip>
The problem is the command "set ScreenUpdating to false".
<snip>
It is however a drag to not "set ScreenUpdating to false"... It will
be much slower.
Late to the thread, so I may have missed this but why do you need to
activate anything? Once the workbooks are open you can just refer to
them by
name or index number without needing to activate or select anything.
Mutating Kai's script as an example
set xlFold to "Hard Disk:Users:UserName:Desktop:Excel Tests:"
set {n1, n2, n3} to {"xlTest1.xls", "xlTest2.xls", "xlTest3.xls"}
tell application "Microsoft Excel"
repeat with w in {n1, n2, n3}
Open (xlFold & w)
end repeat
repeat with w in {n1, n2, n3}
set l to {Column of (LastCell of Range "A1" Direction
xlToRight) of
Worksheet 1 of Workbook w, Value of (LastCell of Range "A1" Direction
xlToRight) of Worksheet 1 of Workbook w} --1 line
end repeat
end tell
--
Dave
This actually works. It is not a good solution in my case, because it
has to be inserted in every command you have targeting the worksheet,
or it will default back to the last workbook opened.
I did not even bother testing that, because if I tell the Workbook,
then tell the Worksheet, the command fails. Why it does not fail here,
I have no clue.
My personal and subjective solution is to "set ScreenUpdating to false"
and before every activate command insert a "set ScreenUpdating to true"
after the activate insert a "set ScreenUpdating to false". It should be
faster than opening and closing the windows and easier to debug than
Dave's suggestion which is the best solution if there are not many
lines of codes targeting each worksheet.
Thanks for the input.
Regards
Deivy Petrescu
http://www.dicas.com/
_______________________________________________
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.