为什么下面的语句不行:
Dim but1 As CommandButton
Set but1 = CreateObject("CommandButton")
With but1
.Top = 2000
.Left = 10000
.Height = 300
.Caption = "ok"
End With
Dim but1 As CommandButton
Set but1 = CreateObject("CommandButton")
With but1
.Top = 2000
.Left = 10000
.Height = 300
.Caption = "ok"
End With
解决方案 »
- vb6 怎么一次性修改rs.Fields(0)字段下的所有内容为空
- 谁知道 怎样在windows 背景也就是screen上画图?
- 已经知道隐藏进程的PID值....
- 如何调用MYSQL的存储过程,如何得到MYSQL存储过程的返回值?
- Data Report控件的问题,熟悉的请帮忙解决。
- 多文档问题!!!!
- 关于for update 的深奥问题。高分求答。
- 菜菜鸟用vb第一次用到数据库,搞不定了,请大虾们帮帮忙。
- 在文件夹中查找cell中关键字为“char"的EXCE文件,对整个文件夹中的excel文件查找!
- 映射问题,大家快来看
- 文件夹拷贝过程中,在程序中我怎么知道拷贝已结束啊!
- 取数相乘的问题(在线等)
Dim but1 As CommandButton
Set but1 = CreateObject("CommandButton")
Load but1
With but1
.Top = 2000
.Left = 10000
.Height = 300
.Caption = "ok"
End With
Form1.Controls.Add "vb.commandbutton", "cmdok" 'dynamical load the button
Dim ctl
With Form1!cmdok
.Visible = True
.Width = 4500
.Caption = "hello"
.Left = Me.Width / 2
.Top = Me.Height / 2
End With
Set ctl = Form1!cmdok
End Sub
Private WithEvents cmdMyButton As CommandButtonPrivate Sub Form_Load()
Set cmdButton=Controls.Add("VB.CommandButton","Button")
With cmdButton
.visible=True
.Width=3000
.Capation="This is a button"
.Top=1000
.Left=1000
End With
End sub
Set but1 = CreateObject("CommandButton") ''问题是就在这一句就报错,说“ActiveX 部件 不能创建对象或返回对该对象的引用”,这是为什么?
With but1
.Top = 2000
.Left = 10000
.Height = 300
.Caption = "ok"
End With
我的意思是如果我用createobject该怎样做才不会报错。是不是progid错误,括号里不应是“CommandButton”?