运行效果
VB编程:利用CallByName函数对对象进行操作-23_彭世瑜_新浪博客_javascript

备注:不是界面优化太差,commad2是通过单击事件改变了其位置

程序代码
Private Sub Command1_Click()
    Text2.Text = CallByName(Text1, "text", VbGet)
End Sub

Private Sub Command2_Click()
    If Command2.Left <> 0 Then
        CallByName Command2, Text3, VbMethod, 0, 0
    Else
        CallByName Command2, Text3, VbMethod, 1000, 200
    End If
End Sub

Private Sub Form_Load()
    Text3.Text = "move"
    CallByName Text4, "mousepointer", VbLet, 15
End Sub