chskypei 发表于 2006-4-7 20:18:00

[VBA]新手求助:这个错误如何处理?

<P>学习使用VBA处理控件数组过程中,对VBA提供的样例代码的编译中出现“无效的类别字符串”不知道该如何处理,请版主帮助。</P>C:\Documents and Settings\Administrator\My Documents\My Pictures\未命名.bmp

mccad 发表于 2006-4-7 21:57:00

代码都没有,神仙啊。

chskypei 发表于 2006-4-8 10:49:00

致<A name=6876><FONT color=#990000><B>mccad</B></FONT></A>:除了被遮盖住的commandbutton的caption属性外,代码全部在图中了。

雪山飞狐_lzh 发表于 2006-4-8 15:42:00

<P>图看不见,把你的代码直接贴上吧</P>

chskypei 发表于 2006-4-10 08:03:00

<PRE class=CT><CODE>Dim MyTextBox As Control</CODE></PRE><PRE class=CT><CODE>Private Sub CommandButton1_Click()<BR> Set MyTextBox = MultiPage1.Pages(0).Controls.Add("MSForms" &amp; ".TextBox.1", "MyTextBox", Visible)</CODE></PRE><PRE class=CT><CODE>End Sub</CODE></PRE><PRE class=CT><CODE></CODE><CODE>Private Sub CommandButton2_Click()<BR>&nbsp;&nbsp;&nbsp; MultiPage1.Pages(0).Controls.Clear<BR>End Sub</CODE></PRE><PRE class=CT><CODE>Private Sub CommandButton3_Click()<BR>&nbsp;&nbsp;&nbsp; If MultiPage1.Pages(0).Controls.Count &gt; 0 Then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MultiPage1.Pages(0).Controls.Remove "MyTextBox"<BR>&nbsp;&nbsp;&nbsp; End If<BR>End Sub</CODE></PRE><PRE class=CT><CODE>Private Sub UserForm_Initialize()<BR>&nbsp;&nbsp;&nbsp; CommandButton1.Caption = "Add control"<BR>&nbsp;&nbsp;&nbsp; CommandButton2.Caption = "Clear controls"<BR>&nbsp;&nbsp;&nbsp; CommandButton3.Caption = "Remove control"<BR>End Sub<BR></CODE></PRE><PRE class=CT><CODE>在黑体下划线行提示“运行时错误'2147221005(800401f3)':无效的类别字符串”,不知该如何处理?请版主帮助。</PRE></CODE>
页: [1]
查看完整版本: [VBA]新手求助:这个错误如何处理?