Link to home
Start Free TrialLog in
Avatar of gerhardub
gerhardub

asked on

How to use Powershell to insert a Comment into Excel cell??

Folks,

How does one go about inserting a comment into a cell in Excel using POWERSHELL?

Basically, I want to modify a cell so that I can add the comment property to it...

[I'm working on an audit form, and I want a short version of the error, and then the ability to however over the red triagle in the corner of the cell to display the full error...]

My code for selecting a cell looks like this:

$CurrentSheet.Cells.Item($ServerRow+1,$ServerCol) = $string

How do I add a comment, insert it into the cell in question, and make it visable?

Thanks all!
Avatar of Tamerlan666
Tamerlan666

Try this:

$CurrentSheet.Cells.Item($ServerRow+1,$ServerCol).Addcomment("comment")

Open in new window

Avatar of gerhardub

ASKER

I tried it using a String, and it blew up in my face:

$CurrentSheet.Cells.Item($ServerRow+1,$ServerCol).Addcomment($SrvAppErrors[1].message)

...then I noted that you can't rewrite a comment over another comment.  ...and it works like a champ.

Maybe I can get you to help me with this:

How do I resize the comment box on the fly?  -grin-

GB
ASKER CERTIFIED SOLUTION
Avatar of Tamerlan666
Tamerlan666

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial