Code  800A01F4 – Variable is undefined

Troubleshooting Code 800A01F4 – Variable is undefined

Introduction to Code 800A01F4

Error code, 800A01F4 occurs when you execute a VBScript.  This is a runtime error, check your variables assigned in the Dim statement.Error 800A01F4 Variable is undefined - Windows Script Host

The Symptoms You Get

The script does not execute as you hoped, instead you get a WSH error message.

The Cause of Code 800A01F4

Your VBScript contain is an undeclared variable.  Most likely, this is a spelling mistake in one of your variables.  The clue here is in the Error:…. ‘DriveLetter11’.  Most likely, this was meant to be DriveLetter1 and not DriveLetter eleven.

Examine YOUR Windows Script Host message box, and check your Line :.  In my example it’s line 12.  The Char : is not much use for error 800A01F4.  My point is that rarely is it the very first Char that’s at fault. 

Incidentally, Source: reports a runtime error not a compilation error, this means you are looking not for a pure syntax problem, but a fault logic error.  In the case of runtime errors, you can use this temporary work around.  Add this statement just before the line which errors: On Error Resume Next.

Marcos reports this error, 800A01F4 in an ASP file calling a JavaScript function.

Note: Almost certainly your script has ‘Option Explicit’ near the top.

  ‡

The Solution for Variable is undefined

Check the syntax of your script. In my VBScript example, ‘DriveLetter11’ on Line 12 is the problem.  In your example all you need is to read the Error: statement – carefully.  Then locate the code referenced by Line:.  Incidentally, Source: reports a runtime error not a compilation error, this means you are looking not for a pure syntax problem, but a fault logic error.

Example of Error Code 800A01F4 Script

Note: Go to Line: 12.   DriveLetter11 should be DriveLetter1  (Not Eleven, but One)

 

‘ VBScript to map two printers from two servers
‘ Guy Thomas February 2010.
‘ ******************************
Option Explicit

Dim objShell, objNetwork
Dim DriveLetter1, DriveLetter2, RemotePath1, RemotePath2
Dim AllDrives, AlreadyConnected, Network1, Network2, i

Set Network1 = CreateObject("WScript.Network")
DriveLetter11 = "S:" ‘ This letter must be in CAPITALS.
RemotePath1 = "\\alan\drivers"

Set objShell = CreateObject("WScript.Shell")
Set objNetwork = CreateObject("WScript.Network")
Set AllDrives = objNetwork.EnumNetworkDrives()

AlreadyConnected = False
For i = 0 To AllDrives.Count – 1 Step 2
If AllDrives.Item(i) = DriveLetter1 Then AlreadyConnected = True
Next

If AlreadyConnected = True then
objNetwork.RemoveNetworkDrive DriveLetter1
objShell.PopUp "Drive " & DriveLetter1 & " disconnected."

Else

objShell.PopUp "Drive " & DriveLetter1 & " no initial connection"

End if

objNetwork.MapNetworkDrive DriveLetter1, RemotePath1
objShell.PopUp "Drive " & DriveLetter1 & " connected successfully."

WScript.Quit
‘ End of Error Code 800A01F4  Script
 

 

 

See More Windows Update Error Codes 8004 Series

Error 800A101A8 Object Required   •Error 800A0046   •Error 800A10AD   •Error 800A000D

Error 80048820   •Error 800A0401   •Review of SolarWinds Permissions Monitor

Error 80040E14   • Error 800A03EA   • Error 800A0408   • Error 800A03EE

Solarwinds Free WMI MonitorGuy Recommends: WMI Monitor and It’s Free!

Windows Management Instrumentation (WMI) is one of the hidden treasures of Microsoft operating systems.  Fortunately, SolarWinds have created the WMI Monitor so that you can examine these gems of performance information for free.  Take the guess work out of which WMI counters to use for applications like Microsoft Active Directory, SQL or Exchange Server.

Download your free copy of WMI Monitor


Do you need additional help?

Give something back?

Would you like to help others?  If you have a good example of this error, then please email me, I will publish it with a credit to you:

 

If you like this page then please share it with your friends