View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default VBA to edit a comment

hi
see debra dalgleish's site on resize a comment;
http://www.contextures.com/xlcomments03.html#Resize

regards
FSt1
"Brent E" wrote:

Good morning,

I am using Windows XP; Office 2002 SP2.
i am trying to put together some code that will:
A. Create a comment in the current cell (without naming the cell by range)
B. Enter the folling text double spaced and bolded
Analysis:
Result:
Reviewers:
C. And size the comment box to a specific size.

I recorded a macro as I performed these operations and got the following
code. (I replaced the cell range references w/ "Activecell" to make the cell
selection more dynamic.)

This is the code from Excel:
Sub Notes()
'
' Notes Macro
' Macro recorded 11/5/2007 by DD065C
'

'
ActiveCell.Select
ActiveCell.AddComment
ActiveCell.Comment.Visible = False
ActiveCell.Comment.Text Text:= _
"DD065C:" & Chr(10) & "" & Chr(10) & "Analysis: " & Chr(10) & "" &
Chr(10) & "Result: " & Chr(10) & "" & Chr(10) & "Reviewers: "
'Selection.ShapeRange.ScaleWidth 1.8, msoFalse, msoScaleFromTopLeft
'Selection.ShapeRange.ScaleHeight 3.41, msoFalse, msoScaleFromTopLeft
'ActiveCell.Comment.Shape.Select True
ActiveCell.Comment.Text Text:= _
"DD065C:" & Chr(10) & "" & Chr(10) & "Analysis: " & Chr(10) & "" &
Chr(10) & "Result: " & Chr(10) & "" & Chr(10) & "Reviewers: "
End Sub

When I run the macro on a new cell, everything works except the lines I have
commented out:
'Selection.ShapeRange.ScaleWidth 1.8, msoFalse, msoScaleFromTopLeft
'Selection.ShapeRange.ScaleHeight 3.41, msoFalse, msoScaleFromTopLeft
'ActiveCell.Comment.Shape.Select True

These always trigger a debug error stating:
Runtime Error '438'. Object does not support this object or method.

Does anybody know why this is occuring and can recommend a correction?

Thanks,
Brent