在VBa excel 2013中调整commentbox图片大小
当我logging一个macros,我得到
Range("C1").Select Range("C1").AddComment Range("C1").Comment.Text Text:="Blabla" Selection.ShapeRange.ScaleHeight 2.3, msoFalse, msoScaleFromTopLeft Selection.ShapeRange.ScaleWidth 23.1, msoFalse, msoScaleFromTopLeft
运行此代码将导致:
运行时错误“438”:对象不支持此属性或方法
任何人的想法?
您可以直接使用Comment
:
With Range("C1") .AddComment Text:="Blabla" With .Comment.Shape .ScaleHeight 2.3, msoFalse, msoScaleFromTopLeft .ScaleWidth 23.1, msoFalse, msoScaleFromTopLeft End With End With
和罗里一样。 添加注释之前,我先添加clearcomments,以避免在注释已经存在的情况下发生错误。
Sub AddCommentAndResize() With Range("C1") .ClearComments .AddComment Text:="Blabla" With .Comment.Shape .ScaleHeight 2.3, msoFalse, msoScaleFromTopLeft .ScaleWidth 23.1, msoFalse, msoScaleFromTopLeft End With End With End Sub