[英]Autosize comment box in Excel 2016 for Mac
我已更新到 Excel 2016,以下在 Excel 2011 中工作的代碼會生成此錯誤。
Dim Commnt As Comment
For Each Commnt In Application.ActiveSheet.Comments ' Autosize all comment boxes on the sheet
Commnt.Shape.TextFrame.AutoSize = True
Next
Excel 2016 中自動調整所有工作表注釋的任務是如何完成的?
經過進一步研究,我嘗試了以下但沒有成功。
Dim Shp As Shape
For Each Shp In wks1.Shapes
With Shp.TextFrame2
.AutoSize = msoAutoSizeShapeToFitText
.WordWrap = msoTrue
End With
Next Shp
如 MSDN 中所述,Comment 的 TextFrame(和 TextFrame2)屬性在 Excel 2016 中是只讀的。
https://msdn.microsoft.com/en-us/vba/excel-vba/articles/shape-textframe-property-excel https://msdn.microsoft.com/en-us/vba/excel-vba/articles /shape-textframe2-property-excel
使用 Excel 365 進行的快速測試表明,可以使用 Shape 對象本身的 Autosize 屬性來實現注釋的自動調整大小。
Dim Commnt As Comment
For Each Commnt In Application.ActiveSheet.Comments ' Autosize all comment boxes on the sheet
Commnt.Shape.AutoSize = True
Next
但是,這似乎不適用於 Excel 2016。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.