• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Scope riddle I can't seem to solve. (Probably very easy to solve for an experienced coder)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scope riddle I can't seem to solve. (Probably very easy to solve for an experienced coder)


  • Subject: Re: Scope riddle I can't seem to solve. (Probably very easy to solve for an experienced coder)
  • From: Christopher Stone <email@hidden>
  • Date: Fri, 21 Mar 2014 11:08:50 -0500

Hey Alastair,

You're having some basic problems referencing objects.

And Excel is a trifle odd here and there in how it does things.

For instance activate object in the script below.

-------------------------------------------------------------------------------------------

tell application "Microsoft Excel"
set wkBook to workbook (get name of active workbook)
set wkSheet to worksheet (get name of active sheet) of wkBook


tell wkBook
activate object sheet "Goofy2"
set wkBkWin to item 1 of (get its windows)


tell wkBkWin
set activeCellAddress to get address of active cell
set activeCellStrVal to string value of active cell
end tell


end tell


end tell

-------------------------------------------------------------------------------------------

As you can see the active cell is a property of the workbook's window not the sheet.

In my opinion you should be able to say: active cell of sheet "Goofy" of worksheet "Disney"

But you can't.

It seems to me that you need to spend a little bit of time with Script Debugger's Object Model view in the Dictionary Viewer.

You might want to look this over too:

http://www.mactech.com/articles/mactech/Vol.23/23.02/2302AppleScript/index.html

You're discovering what makes AppleScript difficult.  The vagaries of implementation in applications, and the usual lack of useful examples provided by the vendor.

Now then.  It happens that there's a fairly extensive scripting guide for Excel, although it's a decade old.

http://download.microsoft.com/download/3/A/7/3A70FB4B-0C6A-43E3-AAB7-AC9166B25632/Excel2004AppleScriptRef.pdf

--
Best Regards,
Chris

 _______________________________________________
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

References: 
 >Scope riddle I can't seem to solve. (Probably very easy to solve for an experienced coder) (From: Alastair Leith <email@hidden>)
 >Fwd: Scope riddle I can't seem to solve. (Probably very easy to solve for an experienced coder) (From: Alastair Leith <email@hidden>)
 >Re: Scope riddle I can't seem to solve. (Probably very easy to solve for an experienced coder) (From: "koenig.yvan" <email@hidden>)
 >Re: Scope riddle I can't seem to solve. (Probably very easy to solve for an experienced coder) (From: Alastair Leith <email@hidden>)
 >Re: Scope riddle I can't seem to solve. (Probably very easy to solve for an experienced coder) (From: Alastair Leith <email@hidden>)

  • Prev by Date: Re: Scope riddle I can't seem to solve. (Probably very easy to solve for an experienced coder)
  • Next by Date: Re: Scope riddle I can't seem to solve. (Probably very easy to solve for an experienced coder)
  • Previous by thread: Re: Scope riddle I can't seem to solve. (Probably very easy to solve for an experienced coder)
  • Next by thread: Re: Scope riddle I can't seem to solve. (Probably very easy to solve for an experienced coder)
  • Index(es):
    • Date
    • Thread