Excel VBA Macro after M365 migration "Runtime error '380': A script engine for the specified language can not be created"

112 Views Asked by At

We are using an Excel File with VBA Macros. Everything works fine and without errors in Excel 2016.

When we are using the same excel file and included Macros in M365 Desktop edition we are getting the error:

1

Runtime error '380': A script engine for the specified language can not be created

The error comes when the following command is executed:
SC.Language = "VBScript"

We tried some configuration changes like in TrustCenter-> Macro properties but without success.

Should we also try this code ?

Dim S As Object
Set S = CreateObjectx86("MSScriptControl.ScriptControl")

S.Language = "VBScript"

VBA-Script Macro should run without error.

1

There are 1 best solutions below

0
Eugene Astafiev On

For security reasons, new builds of Microsoft Office for Microsoft 365 on Windows block activation of VBScript controls. Most users won't be impacted, but some users may see this runtime error when they try to use an add-in or VBA solution that depends on VBScript:

'380' - 'A script engine for the specified language cannot be created.' 

There are two ways you can unblock these controls. The first is by downloading a small package of registry keys. The second, by manually editing the registry yourself.

See VBScript controls blocked in Microsoft 365 client applications for more information.