VBScript runtime error: Object required

On line 75 Char 2,  I receive an error on the code below Microsoft VBScript runtime error: Object required. It's referring either to "objDisable.DoIt" or "objEnable.DoIt" . Can some one help me ? I know I must be missing something easy but I just can't find it.

Thanks

The code is attempting to toggle my wireless NIC on or off without having to use Device Manager.

Code Below

<package>
<comment>
NICToggle.wsf This script looks at your ‘Local Area Connection’
and enables it if disabled, disables it if enabled.
</comment>
<job>
<runtime>
<description>
Script for toggling network connection on/off
</description>

<example> C:\>cscript ToggleNIC.wsf
</example>
</runtime>
<object id = "objShell" progid = "Shell.Application"/>
set objShell=CreateObject("shell.application")
<script language = "VBScript">
'Toggle NIC on or off
Option Explicit
Dim objCP, objEnable, objDisable, colNetwork
Dim clsConn, clsLANConn, clsVerb
Dim strNetConn, strConn, strEnable, strDisable
Dim bEnabled, bDisabled

Const NETWORK_CONNECTIONS = &H31&
strConn = "Local Area Connection"
'strEnable = "En&able" strEnable = "&Aktivieren"
'strDisable = "Disa&ble" strDisable = "&Deaktivieren"
Set colNetwork = Nothing
Set colNetwork = objShell.Namespace(NETWORK_CONNECTIONS)

' Network Connections (independent of country/language)
If colNetwork is Nothing Then
WScript.Echo "Network folder not found"
WScript.Quit
End If

Set clsLANConn = Nothing
For Each clsConn in colNetwork.Items
' In case the LAN is named “connection 2”, etc.

If Instr(LCase(clsConn.name),LCase(strConn)) Then
Set clsLANConn = clsConn
Exit For
End If
Next

'WScript.Echo clsLANConn

If clsLANConn is Nothing Then
WScript.Echo "Network Connection not found"
WScript.Quit
End If

bEnabled = True
Set objEnable = Nothing
Set objDisable = Nothing
For Each clsVerb in clsLANConn.verbs  

'WScript.Echo clsVerb.name

If clsVerb.name = strEnable Then
Set objEnable = clsVerb
bEnabled = False
End If


If clsVerb.name = strDisable Then
Set objDisable = clsVerb
bEnabled = True
End If
Next

If bEnabled Then
objDisable.DoIt
WScript.Echo clsLANConn & " Disabled"
Else
objEnable.DoIt
WScript.Echo clsLANConn & " Activated"
End If

'Give the connection time to stop/start
WScript.Sleep 1000
</script>
</job>
</package>
wtmAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Carl TawnSystems and Integration DeveloperCommented:
Well, strEnable and strDisable are both commented out in your code. So, during your loop odds are that objEnable and objDisable never get set to anything.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.