Execute error: Type Mismatch: 'Execute'



Hello all,

I'm in the process of writing a vbscript that uses KixForms as a GUI
frontend.
According to a number of web pages (and this group) it is possible to
to use it as follows;

Set System = CreateObject("KiXtart.System")

Set Form1 = System.Form()

Set Button1 = Form1.Controls.Button
Button1.Text = "Close"
Button1.OnClick = "WScript.Quit"

Set Label1 = Form1.Controls.Label
Label1.Text = "Hello World!"
Label1.Location = System.Point(12, 9)

Form1.Visible = "True"
Do While Form1.Visible
Execute(Form1.DoEvents)
Loop

This works properly, when the Button1.OnClick is pressed it just exits
however, if I try and create a function that is called when the button
is clicked i.e.

Set Form = CreateObject( "Kixtart.Form" )

Set Button = Form.Button
Button.Text = "Close"
Button.OnClick = "Func_Quit"
Form.Show

Do While Form.Visible
Execute(Form.DoEvents)
Loop

Function Func_Quit
MsgBox "Just a message box"
wscript.echo "Function has been called"
End Function

The script works fine _however_ if I comment out the MsgBox line, the
script displays the "Function has been called" line and then errors
with the following line.

Microsoft VBScript runtime error: Type mismatch: 'Execute'

I've tried to do some debugging and the error occurs when the script
returns to the Execute line.

Please can someone explain what's happening and why it's failing

Many thanks,

Martin.
.