• 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
Applescript Command(s) To Correctly Capture Excel Comments Of Cell
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Applescript Command(s) To Correctly Capture Excel Comments Of Cell


  • Subject: Applescript Command(s) To Correctly Capture Excel Comments Of Cell
  • From: Anthony Fedd <email@hidden>
  • Date: Fri, 17 Nov 2017 15:40:32 +0000 (GMT)

The following block of code "seems to work" to access desired cell values from an Excel file.  I note, "seems to work" only because while I'm certain of the employee name match and the other values (i.e. found row, hire date and affiliated company), I can't tell if I've successfully captured the comment which holds the employee's position title associated with cell "B:found row".

tell application "Microsoft Excel"

   set searchRange to range (("B" & Brunswick_Start as text) & ":B" & Ranger_End as text)

   set foundRange to find searchRange what PAF_Employee with match case

   set fRow to first row index of foundRange

   set rDate to value of range ("L" & fRow as text)

   set rCompany to value of range ("C" & fRow as text)


   set rTitle to its Excel comment of range ("B" & fRow as text)


   select foundRange

end tell


After numerous searches, I've only found the 2007 code below at MacTECH to set a cell comment and I'm not sure it correctly gets the comment of a cell as I've tried to use above.  I get the "Can’t make «class X229» of «class ccel» "B27" of application "Microsoft Excel" into type text" error when attempting to use the comment variable rTitle as text.

In AppleScript:

tell application "Microsoft Excel"

     tell range "A10" of active sheet

          set cmt to its Excel comment -- no error if nothing (dummy comment)

          set vis to visible of cmt --get any property , returns missing value if empty

          if vis is missing value then

              set cmt to add comment

          end if

     end tell

    

     tell cmt

          Excel comment text text "My comment" --overwrites, but omit 'over write'!

          set visible to true

          select its shape object -- to allow editing

     end tell

end tell


What is the correct code to get an existing cell comment?

 _______________________________________________
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

  • Follow-Ups:
    • Re: Applescript Command(s) To Correctly Capture Excel Comments Of Cell
      • From: Christopher Stone <email@hidden>
  • Prev by Date: Re: MS Word: "open file" vs. "open file name" vs. ???
  • Next by Date: Some help please
  • Previous by thread: Re: MS Word: "open file" vs. "open file name" vs. ???
  • Next by thread: Re: Applescript Command(s) To Correctly Capture Excel Comments Of Cell
  • Index(es):
    • Date
    • Thread