Hox to control Comment Shape Sizes?

A

Alain79

Hello

I have some difficulties to succeed to control the size of a "Comment box"
(or shape) attached to a cell... - can you help ?
What I want to do is giving to the Comment "box" the same size than the cell
it is attached to...
I tried through the following code lines:
dim CellToComment as range
set CellToComment = ActiveSheet.range ("A1")
CellToComment..AddComment "This is the comment text"
CellToComment.comment.shape.Width = CellToComment.ColumnWidth
CellToComment.comment.shape.Height= CellToComment.RowHeigh

But the results is not what was expected and seems to depend on another
"factor" ...
Is it a Zoom factor? a Display factor?
For a while it work with the following adjustment...
CellToComment.comment.shape.Width = 2.4 * CellToComment.ColumnWidth
CellToComment.comment.shape.Height= CellToComment.RowHeigh/2.2
but was not correct on another PC...

Thaks for your help
Alan
 
A

Alain79

Here is the solution to my own problem...
In fact Using ColumnWidth was not a good idea
Better to use Cell.Width that return the value in number of points rather
than a value linked to Characters...
Also here is the right way to proceed:

dim CellToComment as range

set CellToComment = range("A1")

CellToComment.AddComment "Texte du Commentaire"

CellToComment.comment.shape.width = CellToComment.Width

CellToComment.comment.Height = CellToComment.Height

....

@+
 

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