Problem Overview
WinCC VBScript projects frequently fail at runtime with the message Script Error ??, ActiveX component can't create object, or Object required: 'connextion'. The typical trigger is a malformed ADO database call inside a WinCC picture, global action, or scheduled C-script converted to VBS. The most common root causes observed in fielded systems are:
- Misspelled automation object names (e.g.
ADODB.connnextioninstead ofADODB.Connection). - Assignment of a recordset to a non-existent object variable (
Set rst = connextion). - Missing
On Error Resume Next/ line-tag tracing so failures are invisible. - Database provider mismatch (SQL Native Client vs ODBC Driver 17 for SQL Server).
- VBScript runtime host blocked by enhanced security configuration in WinCC 7.4 SP1 and later.
vbscript.dll 5.8.
Root Cause Analysis
The WinCC Global Script editor and the picture-event handler compile VBScript at runtime against the Windows Script Host COM components. When CreateObject("ADODB.Connection") is invoked, WinCC calls CoCreateInstance on the ADODB CLSID. If the casing is wrong (VBScript is case-insensitive but the underlying COM registration is not), the API still finds the class but subsequent property accessors raise error 800A01AD "ActiveX component can't create object" or 800A01C9 "Object required".
Three failure modes account for roughly 90% of the reported cases:
| Symptom | Hex Error | Decimal | Root Cause |
|---|---|---|---|
| Object required: 'connextion' | 0x800A01C9 | -2146827671 | Variable typo, never instantiated |
| ActiveX component can't create object | 0x800A01AD | -2146827861 | ADO provider not installed / registered |
| Provider cannot be found | 0x800A0E7A | -2146822278 | SQL Native Client missing or ODBC DSN misconfigured |
| Syntax error | 0x800A03EA | -2146827254 | Reserved word used as variable, malformed Set statement |
Reference Implementation (Siemens Official)
Siemens application example 26283062 — "VBScript database connection in WinCC" is the canonical reference. The verified working pattern is reproduced below with annotated corrections:
Option Explicit
' --- Tag the run path so failures localize instantly ---
Dim sStep
sStep = "01_Declare"
Dim conADODB
Dim rstRecordset
Dim strSQL
Dim iRow
sStep = "02_Create"
Set conADODB = CreateObject("ADODB.Connection")
sStep = "03_Open"
conADODB.ConnectionString = _
"Provider=SQLOLEDB.1;" & _
"Persist Security Info=False;" & _
"User ID=sa;" & _
"Password=Password!;" & _
"Initial Catalog=WinCC;" & _
"Data Source=.\WINCC"
conADODB.CursorLocation = 3 ' adUseClient
conADODB.CommandTimeout = 30
conADODB.Open
sStep = "04_Query"
strSQL = "SELECT Tag, Value FROM dbo.Archive WHERE Tag='TankLevel'"
Set rstRecordset = conADODB.Execute(strSQL)
sStep = "05_Loop"
iRow = 0
Do While Not rstRecordset.EOF
HMIRuntime.Trace "Row " & iRow & ": " & _
rstRecordset.Fields("Tag").Value & "=" & _
rstRecordset.Fields("Value").Value & vbCrLf
rstRecordset.MoveNext
iRow = iRow + 1
Loop
sStep = "06_Close"
rstRecordset.Close
conADODB.Close
Set rstRecordset = Nothing
Set conADODB = Nothing
Corrections applied vs. the original poster's broken script:
- Spelling
ADODB.connnextion->ADODB.Connection. The reference string must match the COM ProgID registered inHKEY_CLASSES_ROOT\ADODB.Connection\CLSID. - Removed
Set rst = connextion. A recordset must be assigned the result ofExecute()orOpen(), never the connection object itself. - Added
Option Explicitto force declaration of all variables (turn on via WinCC Global Script editor menu: Tools -> Options -> Require Variable Declaration). - Added
HMIRuntime.Tracebreadcrumbs so the line at which execution stops is logged to the WinCC diagnosis fileWinCC_Sys_..log
Step-by-Step Troubleshooting Procedure
- Reproduce the error in isolation. Open WinCC Explorer, launch Graphics Designer, place a button on the desired picture, and bind the click event to the suspect VBS action. Press F5 to start Runtime and trigger the script.
- Capture the runtime error code. When the "Script Error ??" dialog appears, copy the hex code from the message line. Typical values are listed in the table above.
-
Enable WinCC trace. In WinCC Explorer, open Computer -> Properties -> Graphics Runtime -> Troubleshooting and set the script trace directory (default
C:\Program Files (x86)\Siemens\Automation\WinCC\Diagnose). Restart Runtime. -
Wrap the procedure with an error handler. Insert
On Error Resume Nextat the top of the action and replaceHMIRuntime.Trace "OK"with structured logging (see next section). -
Verify spelling of automation object names. Compare every
CreateObjectargument against the canonical list documented in Siemens FAQ 26283062. The reference usesADODB.Connection,ADODB.Recordset,ADODB.Command,ADODB.Stream. -
Validate the ODBC DSN. Run
odbcad32.exefrom the WinCC server. Test the connection using the same credentials used in the script. If the test fails, fix the SQL user permissions first; the VBS error will never go away while the DSN itself fails. -
Re-register the ADO type library. From an elevated command prompt run
regsvr32 "C:\Program Files\Common Files\System\ado\msado15.dll". Restart WinCC Runtime. - Confirm VBScript runtime is enabled. On Windows Server 2016 / 2019, the optional feature Win32-ScriptHost can be removed by group policy. Re-enable via Server Manager -> Add Roles and Features -> Features -> Server Side Script Host.
Defensive Scripting Template
The script below combines On Error Resume Next, line tagging via an internal tag, and structured trace output. Use it as the starting template for any database-bound WinCC VBS action.
Option Explicit
' --- Error gate: log and bail on first fault ---
On Error Resume Next
Const TRACE_TAG = "Script.Trace" ' Internal binary tag of 8 bytes
Dim sStep, sMsg
sStep = "00_Start"
' --- Step 1: Create connection ---
Dim con
Set con = CreateObject("ADODB.Connection")
If Err.Number <> 0 Then GoTo Fail
con.ConnectionString = _
"Provider=MSOLEDBSQL.1;" & _
"User ID=sa;" & _
"Password=Password!;" & _
"Initial Catalog=WinCC;" & _
"Data Source=.\WINCC;" & _
"Application Name=WinCC_VBS"
con.Open
If Err.Number <> 0 Then GoTo Fail
' --- Step 2: Run query ---
sStep = "20_Query"
Dim rst
Set rst = con.Execute("SELECT Value FROM dbo.Live WHERE Tag='Level1'")
If Err.Number <> 0 Then GoTo Fail
sStep = "30_Loop"
If Not rst.EOF Then
SmartTags("Level1_Display") = rst.Fields("Value").Value
End If
' --- Step 3: Cleanup ---
sStep = "40_Close"
If IsObject(rst) Then rst.Close
If IsObject(con) Then con.Close
Set rst = Nothing
Set con = Nothing
SmartTags(TRACE_TAG) = "OK at " & sStep
Exit Sub
Fail:
sMsg = "ERR " & Hex(Err.Number) & " at " & sStep & " : " & Err.Description
HMIRuntime.Trace sMsg & vbCrLf
SmartTags(TRACE_TAG) = sMsg
If IsObject(rst) Then rst.Close
If IsObject(con) Then con.Close
Set rst = Nothing
Set con = Nothing
Script.Trace must exist in the WinCC tag manager as an internal 16-bit signed tag (8-byte string is supported by configuring the data type as Text tag, 8 characters). Update the value through SmartTags() in real time and watch the tag online in Graphics Designer to localize the failure point.
ADO Provider Compatibility Matrix
| SQL Server Version | Recommended Provider | Provider String | Notes |
|---|---|---|---|
| SQL Server 2005/2008 | SQL Native Client 10 | SQLNCLI10 |
Deprecated; ship-only |
| SQL Server 2008 R2 / 2012 | SQL Native Client 11 | SQLNCLI11 |
Common WinCC 7.x baseline |
| SQL Server 2014 / 2016 | ODBC Driver 13 for SQL Server | ODBC Driver 13 for SQL Server |
Requires ODBC bridge |
| SQL Server 2017 / 2019 / 2022 | MSOLEDBSQL (Microsoft OLE DB Driver 18) | MSOLEDBSQL.1 |
Preferred for WinCC V7.5+ |
| MySQL / MariaDB | MySQL ODBC 8.0 Unicode | Provider=MSDASQL.1;Driver={MySQL ODBC 8.0 Unicode Driver} |
Use 32-bit ODBC on x86 WinCC |
| Oracle 19c | Oracle OLE DB 19.3 | OraOLEDB.Oracle.1 |
Install 32-bit client on x86 nodes |
Siemens officially supports SQLNCLI11 for WinCC 7.4 and MSOLEDBSQL.1 for WinCC 7.5 SP2 onward. See the WinCC V7.5 SP2 release notes on the Siemens Industry Online Support portal for the certified combinations.
Permission and DCOM Checklist
Database calls fail with cryptic COM errors when launch and access permissions are not granted. Verify the following on every WinCC server and WinCC client that runs the script:
- The Windows user running the WinCC Runtime service is a member of the local group SQLServerMSSQLUser$<SERVER>$MSSQLSERVER or has been granted
db_datareader/db_datawriteron the target database. - DCOM default launch and access permissions include the WinCC service account. Open
dcomcnfg.exe→ Component Services -> Computers -> My Computer -> DCOM Config, right-click Microsoft OLE DB Provider for SQL Server and add the service account to Launch and Activation and Access. - Antivirus / EDR is not blocking
vbscript.dllormsado15.dll. Some enterprise agents (CrowdStrike, Defender ASR rules) quarantine child processes spawned byCCExplorer.exe— add the WinCC installation folder as an exclusion. - For WinCC 7.5 SP1 and newer, enable the registry value
HKLM\SOFTWARE\Wow6432Node\Siemens\WinCC\Diagnostics\ScriptTrace=1(DWORD) before starting Runtime.
Error Code Reference
| Hex | Source | Meaning in WinCC VBS | Fix |
|---|---|---|---|
| 0x800A01AD | Microsoft VBScript | ActiveX component can't create object | Reinstall / re-register msado15.dll; verify ProgID spelling |
| 0x800A01C9 | Microsoft VBScript | Object required: '<name>' | Variable typo or undeclared; remove stray Set statements |
| 0x800A03EA | Microsoft VBScript | Syntax error | Reserved word used as identifier; missing Next, Loop, or End If
|
| 0x800A0CC1 | ADO | Item cannot be found in the collection | Field name mismatch; use rst.Fields("Name") with case-sensitive collation |
| 0x800A0E78 | ADO | Operation is not allowed when the object is closed | Open the recordset before reading fields; check con.State = 1
|
| 0x800A0E7A | ADO | Provider cannot be found. It may not be properly installed | Install matching 32/64-bit OLE DB provider; check Provider= keyword |
| 0x80004005 | COM | Unspecified error | Check DCOM permissions, firewall on SQL port 1433, Named Pipes disabled |
| 0x80070005 | Win32 | Access denied | SQL user lacks SELECT permission; grant db_datareader
|
| 0x80070057 | Win32 | The parameter is incorrect | Connection string malformed; remove trailing semicolon from Provider |
Verification Procedure
-
Runtime smoke test. Trigger the action; the
Script.Traceinternal tag should displayOK at 40_Close. If a failure string is shown, the suffix indicates the offending step. -
Trace file inspection. Open
C:\Program Files (x86)\Siemens\Automation\WinCC\Diagnose\WinCC_Sys_01.log. Search forVBS— everyHMIRuntime.Traceline will be present with timestamp and source line number. -
Process Monitor audit. If the error remains, run Process Monitor filtered on
CCExplorer.exeandmsado15.dllto confirmLoadLibrarysucceeds.NAME NOT FOUNDresults indicate a corrupted or blocked DLL. -
Independent ADO test. From the same machine, open a Command Prompt and run a small VBS file:
cscript //NoLogo C:\test\ado_probe.vbs. The probe should attemptCreateObject("ADODB.Connection")against the same connection string and report success. If the probe fails, the issue is environmental, not in WinCC. -
Service account check. Use
whoami /groupsfrom a Command Prompt launched under the WinCC service account (Sysinternals Psexec) and confirm database login permissions.
Common Edge Cases and Field Notes
-
Periodic "Script Error" every 5–10 minutes. This pattern is unrelated to VBS source code and is caused by a runaway web browser control in WinCC WebNavigator or a popup from
HtmlHost.exe. The Microsoft Q&A thread "Don't know how to get rid of a script error that appears every 5-10 minutes" documents the same dialog appearing with a white background and Yes/No buttons; the fix is to disable script debugging in Internet Explorer (Tools -> Internet Options -> Advanced -> Disable script debugging) or upgrade to WinCC 7.5 SP2 which replaces the WebClient active X control. -
Works in the editor, fails at Runtime. The Global Script editor runs under the interactive user; Runtime runs under the system account
CCAdmin. Permissions to the SQL server differ. Always verify under Runtime. -
64-bit / 32-bit mismatch. WinCC V7.x is 32-bit. Even on a 64-bit OS you must install the 32-bit OLE DB provider and create the DSN with the 32-bit
C:\Windows\SysWOW64\odbcad32.exe. Mixing providers returns0x800A0E7A. -
Power loss / unclean shutdown. If the SQL Server hosting the WinCC archive database restarts unexpectedly, the first ADO call from a still-running Runtime may return
0x80004005. Wrap everycon.Openin a retry loop with exponential back-off (200 ms, 400 ms, 800 ms). - Circular reference between tags and scripts. Writing to a tag inside the same script that reads it can deadlock Runtime. Use intermediate memory tags.
- Variable not declared when Option Explicit is on. Activate it via Tools -> Options in Global Script editor; VBS will refuse to compile any undeclared identifier.
Performance Considerations
Database calls are blocking. A long-running SELECT in a picture-level event freezes the Graphics Designer thread for the full duration. Best practice from the Siemens WinCC Performance Guideline:
- Move all database operations into a scheduled global action triggered by a timer (default 1 s, increase to 5–10 s if the query is heavy).
- Open the connection once at project startup, store it in a process-global variable using
Application.Variables, and reuse the handle. - Cap result sets with
TOP nin the SQL string to avoid streaming the entire archive. - Index the columns referenced in
WHEREclauses; a missing index onTagin the WinCC archive schema can add seconds to every read.
Upgrade Path Recommendations
WinCC 7.0 / 7.1 (released before 2010) reach end of support and rely on legacy SQL Native Client 10. Upgrade to WinCC 7.5 SP2 (or newer) and migrate the database provider to MSOLEDBSQL.1 simultaneously. The WinCC compatibility tool CCConfigExplorer.exe validates the new provider string and updates all *.MOF files automatically. Refer to the WinCC V7.5 SP2 release notes on the Siemens Industry Online Support portal for the migration checklist.
What is the most common cause of the WinCC "Script Error ??" dialog when calling ADODB?
The most common cause is a misspelled automation object name — for example ADODB.connnextion instead of ADODB.Connection — combined with a missing error handler. Correct the spelling to the canonical ProgID ADODB.Connection and either remove the line entirely or wrap the script with On Error Resume Next plus an HMIRuntime.Trace log entry.
How do I find the exact line of a VBScript runtime error in WinCC?
Insert a sentinel variable that is updated at every checkpoint (e.g. sStep = "20_Query") and write it to an internal tag (SmartTags("Script.Trace") = sStep) plus HMIRuntime.Trace sStep. When the error occurs, the last reported step is the failing line. For deeper diagnostics, enable the registry value ScriptTrace=1 under HKLM\SOFTWARE\Wow6432Node\Siemens\WinCC\Diagnostics and inspect the WinCC_Sys_*.log in the Diagnose folder.
Why does my WinCC script work in the Global Script editor but fail at Runtime?
The Global Script editor executes VBS under the interactive Windows user while Runtime runs under the system account CCAdmin (or the WinCC service account). The system account usually lacks SQL login permissions and cannot load per-user ODBC DSNs. Grant the service account a SQL login with db_datareader rights and create a system DSN with C:\Windows\SysWOW64\odbcad32.exe.
Which OLE DB provider should I use with WinCC V7.5 and SQL Server 2019?
Use the Microsoft OLE DB Driver for SQL Server (MSOLEDBSQL) version 18.6 or newer with the connection string Provider=MSOLEDBSQL.1;Data Source=<SERVER>;Initial Catalog=WinCC;User ID=<user>;Password=<pwd>;. Older SQLNCLI11 providers may install but are not certified for SQL Server 2019 and can return intermittent 0x800A0E7A errors.
How do I stop the recurring "Script Error" dialog that appears every 5–10 minutes?
This dialog is typically produced by the embedded WebNavigator HTML host, not by your VBS action. Disable Internet Explorer script debugging (Tools -> Internet Options -> Advanced) or upgrade to WinCC 7.5 SP2 which replaces the WebClient control with a non-blocking renderer. Confirm by killing the CCWebClient.exe process — if the dialog stops, the source is the browser host, not the application script.