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

I didn't run your code but the first two commented out lines work on the
'Selection'. Clearly the selection is supposed to be the comment box. Yet
a few lines before you make the comment Visible=False so it cannot be the
selected object. I'd start by moving that line to the end of the code.

--
Jim
"Brent E" wrote in message
...
| 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
|
|