add comment to object

V

voodooJoe

i never heard of a 'comment' property and you don't say what kind of object.
what i'll assume is you want to associate some sort of permanent text
string?

depending on the object, i sometimes i hijack another property for what I
want. the TAG property (e.g., userforms, toolbar buttons) as easy when
available
sometimes its easy to use a custom document property, a name, a cell on a
hidden sheet, or a registry entry (check out savesetting and getsetting
fuctions)

you can attach to any existing object model if you could create your own
object:

Public Type objWS
sht As Worksheet
myComment As String
End Type

Sub x()
Dim s As objWS
Set s.sht = Sheet1
s.myComment = "some text"
Debug.Print s.sht.Name & " " & s.cmt
End Sub

HTH - voodooJoe
 
G

Guest

Not really following. Objects have properties (describe the object or an
attribute of the object) and methods (things the object can do). What do you
mean by a comment.

Additionally is this object one of the existing Objects from Excel (such as
a sheet or a range) or is this a custom object you created by instantiating a
class that you wrote?
 
D

Dave Peterson

If you mean a shape on the worksheet, maybe you can widen the column, increase
the row height and put a comment on that cell that is below that object.

You'll see the comment when your mouse is over the cell, but not over the shape.
 
G

Guest

Sorry for the bad question.

Thanks for the help.

I want to find a way that I can create a help button (a text box named
"rectangle 13") so that if the user needs help on the tem, they can click on
the help object and a help screen like a comment will popup.

I have an Object = Rectangle 13. To it i added a macro "a"

macro "a" = ActiveSheet.Shapes("Rectangle 13").Comment.Text Text:="Test"
& Chr(10) & ""

I hope this helps some.

Again, Thanks for the help
 
D

Dave Peterson

You could assign a macro to that rectangle (just rightclick on it and choose
assign macro).

If the amount of words is small, you could use a message box:

option explicit
sub testme()
msgbox "Your help text here"
end sub

If the amount of words is large, you could create your own user form and show
that.

John Walkenbach has done lots of the work for you:
http://j-walk.com/ss/excel/tips/tip51.htm
 
G

Guest

Dave: Thanks for your responses. The first response would work, in a round
about way. The MsgBox was an option, however I have not made professional
looking MsgBoxes (long ones) and it is a large amount of words. In my
initial research I started with Walkenbach's Chapter 23 "Providing Help for
Your Applications" from his book Excel 2000 Power Programming w/ VBA. I
thought there would be easier ways such as attaching a comment to a
object/shape.

I will go from here, to the site you led me to.

Again thanks you and the others for your time and help.
 

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