Error 1032 Invalid Character
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn microsoft vbscript compilation error invalid character 1 1 more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags microsoft vbscript compilation error 800a0400 Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, vbscript compilation error syntax error helping each other. Join them; it only takes a minute: Sign up Why does VBScript say “Invalid Character” when using ExecuteGlobal to import a .vbs function library file? up vote 2 down vote favorite 2 I am microsoft vbscript compilation error: expected statement encountering a "Invalid Character" error in my VBscript! In particular, within this block of code: '******************************************************************* 'Import Code 'by Cheyne Wallace 'November 2008 'When using only VBscript (not QTP), this code will import any function library passed into it. 'Copy this function into a file, then use it to bring in various other function libraries. 'Usage: ' Import "Library.vbs" Sub Import(strFile) Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject") Dim wss : Set wss = CreateObject("WScript.Shell") strFile
Microsoft Vbscript Compilation Error '800a03ea'
= wss.ExpandEnvironmentStrings(strFile) strFile = objFSO.GetAbsolutePathName(strFile) Set objFile = objFSO.OpenTextFile(strFile, 1) ExecuteGlobal objFile.ReadAll objFile.Close : Set objFSO = nothing Set wss = Nothing End Sub The error states "Microsoft VBScript compilation error. Invalid Character. Code: 800A0408" on Char: 2, Line 206 which is the very first letter on ExecuteGlobal objFile.ReadAll (character 1 is a tab). I have typed and retyped the line, as well as the surrounding line breaks. Still, it keeps saying 'Invalid character'. What is going on?? character-encoding vbscript import importerror invalid-characters share|improve this question edited Aug 22 '13 at 0:25 asked Dec 21 '12 at 19:56 Eptin 56931131 add a comment| 2 Answers 2 active oldest votes up vote 4 down vote accepted As it turns out, the problem was not with ExecuteGlobal, but instead with the .vbs file I was attempting to import. The file I was importing was not in ANSI encoding. If VBScript has a problem with the file you are importing, it will report the error at the character and line for the beginning of ExecuteGlobal (which admittedly causes confusion). Open the file you are attempting to import, convert it to ANSI and everything should work. share|improve this answer answered Dec 21 '12 at 19:56 Eptin 56931131 add a comment| up vote 1 down vote FYI for those with the same problem in the future, to fix this: Open
- Invalid Character Introduction to Code 800A0408 This error code, 800A0408 occurs when you execute a VBScript. A wild guess a problem with
Microsoft Vbscript Compilation Error Fix
an apostrophe, possibly in a 'REM statement. The Symptoms You Get The microsoft vbscript compilation error 800a0401 script does not execute as you had hoped. Instead you get a WSH message box like this picture: microsoft vbscript compilation error expected end of statement The Cause of error 800A0408 Your VBScript contains an illegal character, often at the beginning of a line. It can happen if you copy the script from word, then http://stackoverflow.com/questions/13996394/why-does-vbscript-say-invalid-character-when-using-executeglobal-to-import-a paste into notepad. For example, to 'Rem out a line we need the apostrophe, which is ASCII character 39; however if you paste from word you may get ASCII 96 (Grave accent).Note the clue Source: Microsoft VBScript compilation error, this means a syntax error in your script. The Solutions Check the punctuation marks in your VBScript, particularly look http://www.computerperformance.co.uk/Logon/code/code_800A0408.htm out for apostrophes and commas that do not display correctly. The reference to Line: 1 Char 1, means that the very first symbol that is probably wrong. ‡ Example 1 of error code 800A0408 - Invalid Character Note: The error ‘Rem VBScript It should be ' Rem VBScript ‘ Rem VBScript Set WshShell = WScript.CreateObject("WScript.Shell") Set WshNetwork = WScript.CreateObject("WScript.Network") Set AllDrives = WshNetwork.EnumNetworkDrives() DriveLetter = "N:" 'must be capitalized RemotePath = "\\alan\home" AlreadyConnected = False For i = 0 To AllDrives.Count - 1 Step 2 If AllDrives.Item(i) = DriveLetter Then AlreadyConnected = True Next If AlreadyConnected = False then WShNetwork.MapNetworkDrive DriveLetter, RemotePath WshShell.PopUp "Drive " & DriveLetter & " connected successfully." Else WShNetwork.RemoveNetworkDrive DriveLetter WshShell.PopUp "Drive " & DriveLetter & " disconnected." End if » Example 2 Code 800A0408 - Invalid CharacterI include this screen shot just to emphasise that Char: number need not be one. Thus Char: 20, or what ever your char number is, becomes a big clue in tracing obscure characters that may have sneaked into your script. See M
• All times are UTC - 5 hours © Copyright Ventis Media Inc. | Powered by phpBB Sitemap | Contact | Privacy | Affiliates