Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How can I instantiate ActiveX object in VBScript?

429 views
Skip to first unread message

Jan Bares

unread,
Sep 3, 1998, 3:00:00 AM9/3/98
to
Hi,

I want to do the following code in VBScript. Can you help me?

Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
Dim Data As MSForms.DataObject
Set Data = new MSForms.DataObject
Data.SetText ("Nazdar")
Data.StartDrag
End Sub

--
Jan Bares
JPCAD Graphics Engine Developer (http://www.antek.cz)

Andrew Clinick(MS)

unread,
Sep 3, 1998, 3:00:00 AM9/3/98
to
You need to use CreateObject. VBScript does not support references, early
binding and types like VB. So Dim Data as MSForms.DataObject wont work.
Change your code to:

Private Sub Label1_MouseDown(Button , Shift,X , Y )
Dim Data
Set Data = CreateObject("MSForms.DataObject")


Data.SetText ("Nazdar")
Data.StartDrag
End Sub

--
Regards

Andrew Clinick
Microsoft Scripting Program Manager
http://msdn.microsoft.com/scripting

Jan Bares wrote in message <01bdd74a$9013a440$0201a8c0@jan>...

Jan Bares

unread,
Sep 4, 1998, 3:00:00 AM9/4/98
to
This should work, but unfortunately, the CreateObject fails. In my opinion,
there is no "MSForms.DataObject" ProgID, there are only "Forms.Listbox.1"
etc. It works for you? What else can I try? Can I feed CLSID to
CreateObject?

BTW, this code crashes my IE 3.02


Private Sub Label1_MouseDown(Button , Shift,X , Y )
Dim Data

Set Data = CreateObject("Forms.Label.1")
Data.Caption = "Crash"
End Sub

Sure, this code is strange, but ...

--
Jan Bares
JPCAD Graphics Engine Developer (http://www.antek.cz)

> You need to use CreateObject. VBScript does not support references,

0 new messages