get text of comment in Applescript

E

Ed Zachary

How does one get the text of an Excel 2004 comment in Applescript?
I've tried such things as "get value of Excel comment", "get text of
Excel comment", etc, with no luck. Here's an example based on the
sample on page 83 of the Excel 2004 AppleScript reference.

tell application "Microsoft Excel"

add comment range "E5" of worksheet 1 comment text "reviewed by
Jessica"

get value of Excel comment of range "E5" of worksheet 1

end tell
 
D

Dave

tell application "Microsoft Excel"
get text of Comment of Range "B2" of Worksheet 1
end tell

Pretty much nothing in the sample works.
 
E

Ed Zachary

Hmmm... that doesn't work for me. I'm using Excel 11.2 (050714) and
OSX 10.4.3. Does Dave's suggestion work for anyone else under Excel
2004 (aka 11.2)?
 
D

DerekSn [MS]

Ed said:
Hmmm... that doesn't work for me. I'm using Excel 11.2 (050714) and
OSX 10.4.3. Does Dave's suggestion work for anyone else under Excel
2004 (aka 11.2)?

Hello Ed,
Try this out for getting the text of a comment in Excel 2004 for a cell
range you supply:

tell application "Microsoft Excel"
add comment range "A1" comment text "Hello"

set MyText to Excel comment text Excel comment of range
"A1"

return MyText
end tell

This will return "Hello"

Here the syntax is "Excel comment text [Excel comment]" which is a
little different from not needing to use the "Excel" qualifier when
creating the comment.

This posting is provided "AS IS" with no warranties, and confers no
rights.

-Derek Snook, Excel test lead
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top