use*_*778 3 excel vba excel-vba
我创建宏工具,允许以编程方式在Excel中创建按钮,但最后我需要调用"分配宏"对话框:
让用户选择他想要分配给创建按钮的宏.我怎么能做到这一点?
实际代码:
Dim btn As Shape
Set btn = wsSheetToAddButton.Shapes.AddFormControl(Type:=xlButtonControl, Left:=buttonLocation.Left, Top:=buttonLocation.Top, Width:=128, Height:=75)
With btn
With .TextFrame.Characters
.Caption = buttonText
With .Font
.FontStyle = "Bold"
.ColorIndex = textColor
End With
End With
.Select
End With
Run Code Online (Sandbox Code Playgroud)