[VBA][请教]如何用代码创建窗体,并在窗体中添加按钮等控件?
<P>请问如何用代码创建窗体,并在窗体中添加按钮等控件??</P> <P>我也再找啊</P><P>希望高手赐教</P> 有难度 <P>或者怎样在已有的窗体中 用代码创建控件 ?有什么方法吗,各位?</P> <P>VBA帮助里就有例子:</P>
<P>Dim Mycmd As Control<BR>Private Sub CommandButton1_Click()</P>
<P> Set Mycmd = Controls.Add("Forms.CommandButton.1", "CommandButton3", Visible)<BR> Mycmd.Left = 18<BR> Mycmd.top = 150<BR> Mycmd.Width = 175<BR> Mycmd.Height = 20<BR> Mycmd.Caption = "非常有趣。" & Mycmd.Name<BR> <BR>End Sub</P>
<P>Private Sub UserForm_AddControl(ByVal Control As MSForms.Control)<BR> Label1.Caption = "控件已被添加。"<BR>End Sub</P>
页:
[1]