Sub Comments_Size()
Dim MyComments As Comment
For Each MyComments In ActiveSheet.Comments
With MyComments
..Shape.Width = 200 'change this number to get size you want
..Shape.Height = 200 'change this number to get size you want
End With
Next ' comment
End Sub
Do you know how to control Excel from Access? If not, post back...
HTH,
Ryan---
--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.
"Bill Sturdevant" wrote:
> In Access 2007, I create an Excel 2007 spreadsheet. I am successfully able
> to add comments to cells with this code:
> xlsheet.Cells(J, I + 1).Interior.ColorIndex = 4
> xlsheet.Cells(J, I + 1).AddComment "Blah blah blah."
> xlsheet.Cells(J, I + 1).Comment.Visible = False
>
> I am successfully able to control the font properties of those comments with
> this code:
> For Each x In xlsheet.Comments
> With x.Shape.TextFrame.Characters.Font
> .Name = "Calibri"
> .Size = 8
> .Bold = False
> End With
> Next x
>
> But, how do I control the SIZE of the comment boxes?
> I have tried this code:
> xlsheet.Cells(J, I + 1).Select
> Selection.ShapeRange.ScaleHeight 2, msoFalse, msoScaleFromTopLeft
> Selection.ShapeRange.ScaleWidth 2, msoFalse, msoScaleFromTopLeft
>
> But, it fails with "Runtime error 438: Object doesn't support this property
> or method".
>
> I have references to Excel 12.0 and Office 12.0 in my Access ACCDB.
>
> --
> Bill
|