Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2006

Tip: Looking for answers? Try searching our database.

setting comment text from VB code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brad Sumner - 23 Mar 2006 22:13 GMT
I am needing to have VB code place text into the comment box of a series of
cells.  Currently the text to be placed is being retrieved from other areas
and being held in a array.  At the conclusion of another routine it needs to
be placed on a comparison page for comparing a group of choices.  I have
tried using "Activecell.Comment  = Comments(X)" where Comments(X) is the
array with the info.  However this results in a error "Object does not
support this property or method".  Honestly I am at a loss on how to
acomplish what I am wanting.

 I have looked in the help documentation but was not able to locate what I
need.  I appreciate all help given.
Randy  Harmelink - 23 Mar 2006 22:55 GMT
>> Activecell.Comment  = Comments(X) <<

Incorrect syntax.

If the cell doesn't already have a comment, you need to add it first:

   ActiveCell.AddComment

Then, to set the text of the comment:

   ActiveCell.Comment.Text Text:=Comments(X)
Trevor Shuttleworth - 23 Mar 2006 23:09 GMT
To find the Help just type comment, cursor into the middle of the word and
press F1.

To add a comment:

With Worksheets(1).Range("e5").AddComment
   .Visible = False
   .Text "reviewed on " & Date
End With

To modify a comment:

Worksheets(1).Range("E5").Comment.Text "reviewed again on " & Date

Fot the Active Cell:

With ActiveCell.AddComment
   .Visible = False
   .Text "reviewed on " & Date
End With

Regards

Trevor

>I am needing to have VB code place text into the comment box of a series of
> cells.  Currently the text to be placed is being retrieved from other
[quoted text clipped - 9 lines]
>  I have looked in the help documentation but was not able to locate what I
> need.  I appreciate all help given.
Gary''s Student - 24 Mar 2006 02:15 GMT
Range("E6").Select
Range("E6").AddComment
Range("E6").comment.Visible = False
Range("E6").comment.Text Text:="Happy Day"

is a syntax that works.  In your case "Happy Day" would be replaced by an
element of your string array.
Signature

Gary's Student

> I am needing to have VB code place text into the comment box of a series of
> cells.  Currently the text to be placed is being retrieved from other areas
[quoted text clipped - 7 lines]
>   I have looked in the help documentation but was not able to locate what I
> need.  I appreciate all help given.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.