View Single Post
  #1 (permalink)  
Old December 15th, 2004, 05:24 PM
jmischo jmischo is offline
Registered User
 
Join Date: Dec 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Calling external classes and/or subs/funcs

I'm having a lot of trouble getting my VBS to do what I want it to. I can't seem to figure out how to a) register a class that resides in a file, b) call a sub that resides in a file, or c) not go nuts.

Yes, it's driving me nuts. addToQueue is defined in pcontrol.vbs as a Sub. Originally it was in a class in that file, but I couldn't figure out how to instantiate a class from a file, so I just put the subs in the file.

Below is a snippet of code (names changed to protect the innocent, and my job...). When it actually calls addToQueue, it gives me a Type Mismatch error that refers to the first character of the function name.

Code:
<SCRIPT language=VBScript src="pcontrol.vbs"></SCRIPT>
<SCRIPT language=vbscript event=onclick for=btnAddToQueue>
<!--
Dim myFields
Dim tmpMSG
Dim myMSG
Dim myP
Dim myR
Dim myA
Dim msgRET

Set myFields = MSODSC.CurrentSection.DataPage.Recordset.Fields

myP = myFields.Item("PN").value
myR = myFields.Item("RN").value
myA = myFields.Item("AN").value

myMSG = "PID: " & Left(myP, 4) & "  RID: " & myR & "  AID: " & myA
msgRET = MsgBox(myMSG, 65, "Adding to queue")
if msgRET = 1 Then
addToQueue Left(myP, 4), myR, myA
else
MsgBox "Aborted.", 48, "Add to Queue"
End If
-->
</SCRIPT>
Reply With Quote