Set the count of the Rows and Columns are there in the embedded Excel object's height and wide

北慕城南 提交于 2019-12-11 17:00:28

问题


There is a MS-Word document.

A Macro-Enabled Excel object was embedded.

I need setting the embedded Excel object's Height and Width with count of the -respectively- Rows and Columns are there involved.

As marked above picture with the red circles, it would be resizing by dragging with mouse.

How can perform this resizing with a macro in the embedded Excel's module?

Setting the Embedded object's height equal the count of Excel's Table Rows

Setting the Embedded object's width equal the count of Excel's Table Columns

Private Sub Worksheet_Change(ByVal Target As Range)

    'Automatically change the count of the rows and columns are in there in the embeded object's height and width.

    EmbeddedObjectHeight = Range("Table1").Rows.Count
    EmbeddedObjectWidth=Range("Table1").Columns.Count

End Sub

来源:https://stackoverflow.com/questions/48202980/set-the-count-of-the-rows-and-columns-are-there-in-the-embedded-excel-objects-h

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!