Excel VBA – 使用组的形状放置行为

我有许多组和button连接到数据透视表。 我想要设置所有这些不移动和单元格的大小。 我正在使用下面的代码来完成这一点。 这对群组工作正常,但不访问组内的button。

这些button位于嵌套组中。 我如何访问这些组中的button?

我试过了

Sheet1.Shapes.SelectAll Selection.UnGroup 

在代码开始时清除所有组。 这使我可以更新嵌套在组中的button。 如何在不首先清除页面上的所有组的情况下以不同的方式访问各个组中的button?

 Group 26 (A group containing slicers and buttons) Group box 28 (A Form Control Group Box) Group 24 (A Grouping of the buttons) btn_do_this btn_do_that 

有任何想法吗??

 Private Sub Cmd_Move_and_size_Click() Dim sh As Shape Dim StrText As String For Each sh In ActiveSheet.Shapes ' If sh.Type = 12 Then sh.Visible = True 'show button! ' Debug.Print (CStr(sh.Type) + " " + sh.Name StrText = " Shape will not move and size with cells" If sh.Placement <> xlFreeFloating Then sh.Placement = xlFreeFloating Else sh.Placement = xlMoveAndSize StrText = " Shape WILL move and size with cells" End If Next MsgBox StrText End Sub