Re: Jscript executing



Hard to tell without seeing the content of Class1
This code works fine for me:

Form1:
Option Explicit
Private Sub Form_Load()
Dim MyClass As Class1
Set MyClass = New Class1
ScriptControl1.AddObject "MyClass", MyClass
ScriptControl1.ExecuteStatement "MyClass.MyDate = Now()"
MsgBox MyClass.MyDate
Set MyClass = Nothing
End Sub

Class1:
Option Explicit
Public MyDate As Date

"Jarek" <jarek@xxxxxxxxxxxxxx> wrote in message
news:dhe2hr$70n$1@xxxxxxxxxxxxxxxxxxxxxxx
> Is it posibble to executing JavaScripts from VB6 by MSScriptControl but
> I want to pass pointer to VB Object???
> Anyway my example: (not works, Why? )
>
> Set MyClass = New Class1
>
> ScriptControl1.AddObject "MyClass", MyClass
> ScriptControl1.ExecuteStatement "MyClass.MyDate = Now()"
>
> MsgBox MyClass.MyDate
>
> Set MyClass = Nothing


.



Relevant Pages

  • Re: How to terminate an object thats in a collection
    ... Another way to refer to multiple instances of the same class would be with ... Dim arrClassas Class1 ... Coll.Remove 1 'removes item from collection, but MyClass still ... Removing an object from a collection won't remove it from memory, ...
    (microsoft.public.excel.programming)
  • Re: How to terminate an object thats in a collection
    ... Dim col As Collection ... Dim MyClass As Class1 ... Set MyClass = Nothing ' or goes out of scope ...
    (microsoft.public.excel.programming)
  • Re: Overloading binary + operator
    ... You should be creating a *new* instance of MyClass, ... should be something to create a new instance of MyClass from class1, ... This clearly isn't your real code, ... can't tell which mistakes (e.g. using property2 instead of property1) ...
    (microsoft.public.dotnet.languages.csharp)
  • insatiate a class based on a string
    ... Was wondering if there was a better way to insatiate a class based on ... {myClass c1 = new class1();} ...
    (comp.lang.java.programmer)
  • Re: Adding Printed at time & date to document
    ... Name it myClass. ... Private Sub mWordApp_DocumentBeforePrint(ByVal Doc As Document, ... Dim oRng As Word.Range ... In a project module initiate the class module when the document opens ...
    (microsoft.public.word.vba.general)