Solved HTA - Keep getting Object required

July 30, 2015 at 05:23:51
Specs: Windows 7, 12GB
I keep getting the following error and I can't figure out what the issue is ...

Line: 22
Error: Object required: 'Serial'

<html>
<head>
<title>Warranty Check</title>
<HTA:APPLICATION
ID="objTest"
APPLICATIONNAME="CheckWty"
SCROLL="no"
SINGLEINSTANCE="yes"
>
</head>

<SCRIPT LANGUAGE="VBScript">

Sub Window_Onload
window.resizeTo 420,150
End Sub

Sub CheckWty
Dim oShell, oExec, oResult, strSerial, Serial
Set oShell = CreateObject ("WScript.Shell")
comspec = oShell.ExpandEnvironmentStrings("%comspec%")
Set strSerial = UCase(Trim(Serial.Value))
Set oExec = oShell.Exec (comspec & " /C for /f " & chr(34) & "tokens=2 delims=," & chr(34) & " %n in " & chr(40) & chr(39) & "type CCR-0107.csv ^" & chr(124) & " find " & chr(34) & strSerial & chr(34) & chr(39) & chr(41) & " do @echo %n")
Set oResult = oExec.StdOut.ReadLine
DataArea.InnerHTML = oResult
End Sub

</SCRIPT>

<body>

Serial Number<br/>
<input type="text" name="Serial" value="">
<left><input id=runbutton input type="button" value="Check Warranty (CCR)" onClick="CheckWty">

<span id = "DataArea"></span>

</body>

</html>


See More: HTA - Keep getting Object required

Report •

#1
July 30, 2015 at 10:01:02
✔ Best Answer
Dim oShell, oExec, oResult, strSerial, Serial
. . . . .
Set strSerial = UCase(Trim(Serial.Value))
You declare "Serial," but never set it to anything. Also, you're trying to set a string, which will generate another error once you get that far.

How To Ask Questions The Smart Way


Report •

#2
July 30, 2015 at 10:15:06
Thanks, I also had remove "Set" from "...strSerial" and "...oResult"

Report •
Related Solutions


Ask Question