Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21271

[RESOLVED] Using MS Script Control Version 1.0

$
0
0
I got this code from here a few months back that uses Micro Soft Script Control 1.0 and I am getting an error runtime error '438' Object doesn't support this property or method but according to the properties of the control it does.

Here is the code I'm using

Code:

Private Sub cmdRun_Click()
 Dim T0 As Single
   
 T0 = Timer()
   
 txtScript.Enabled = False
 cboLanguage.Enabled = False
 cmdRun.Enabled = False
   
 With txtOutput
  .Text = ""
  .SelStart = 0
  .Refresh
 End With
   
 With scScript
  .AddObject "WScript", WScript, True
  .Language = cboLanguage.Text
       
  On Error Resume Next
  .AddCode txtScript.Text
       
  On Error GoTo 0
     
  Dim parms(0) As Variant
  Dim proc As String
     
  parms(0) = "arg1"
  proc = "start"
     
  ' Runtime error 438 - Object doesn't support this property or method
  .Run proc, parms

       
  If .Error.Line > 0 Then
    txtOutput.SelText = "#Error " & .Error.Number & " (&H" _
                        & Right$(String$(7, "0") & Hex$(.Error.Number), 8) _
                        & ") at line " & .Error.Line & vbNewLine _
                        & .Error.Description
  Else
    txtOutput.SelText = "#Completed in " & Format$(Timer() - T0, "0.0####") & " seconds"
  End If
 
  .Reset
 End With
   
 txtScript.Enabled = True
 cboLanguage.Enabled = True
 cmdRun.Enabled = True
 txtScript.SetFocus
End Sub

When I look at the properties of the control I see this:

Run(ProcedureName As String, ParamArray Parameters() As Variant)

Viewing all articles
Browse latest Browse all 21271

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>