我正在尝试获取我在 excel 用户窗体表单上动态创建的按钮,以运行transfer
我在Module 1
项目的“模块”部分中编写的宏。
下面我粘贴了到目前为止我在用户窗体中编写的代码,它实际上设法Transfer to Sheet
在框架中创建按钮(我也动态创建了)但是由于某种原因,当我运行 VBA 时,我收到一条438 error
消息说Object doesn't support this property or method
.
谁能告诉我如何解决这个问题?
这是代码:
Dim framecontrol1 As Control
Set workitemframe = Controls.Add("Forms.Frame.1")
With workitemframe
.Width = 400
.Height = 400
.Top = 160
.Left = 2
.ZOrder (1)
.Visible = True
End With
workitemframe.Caption = "Test"
Set framecontrol1 = workitemframe.Controls.Add("Forms.commandbutton.1")
With framecontrol1
.Width = 100
.Top = 70
.Left = 10
.ZOrder (1)
.Visible = True
.Caption = "Transfer to Sheet"
End With
framecontrol1.OnAction = "transfer"