In May 2024, Microsoft announced the phased deprecation of VBScript in Windows, as detailed in the official Windows IT Pro Blog. This change impacts VBA developers who rely on VBScript, particularly for reference libraries such as regular expressions. This post outlines the upcoming changes and provides guidance to help you future proof your VBA projects.
How VBA projects use VBScript
Visual Basic for Applications (VBA) automates tasks and extends functionality in Office applications, including Excel, Word, PowerPoint, and Access. VBScript is commonly used in VBA projects in two ways:
- Executing external .vbs scripts from VBA.
- Referencing VBScript type libraries, such as VBScript.RegExp for regular expressions.
VBScript deprecation timeline
VBScript will be deprecated in three phases.
- Phase 1 (now through 2026 or 2027): VBScript remains enabled by default as a Feature on Demand (FOD). All existing VBA projects will continue to run as they do today.
- Phase 2 (approximately 2026 or 2027): VBScript FODs will be disabled by default.
- Phase 3 (TBD): VBScript will be completely removed from future Windows releases.
- Calling .vbs scripts from VBA will no longer be supported
- References to VBScript RegExp library will break unless the Office client is updated to a supported build.
For more details, see VBScript deprecation: Timelines and next steps. Starting with Office Version 2508 (Build 19127.20154) on Windows, RegExp classes are included in the VBA for Office by default. This enables the use of RegExp functions in VBA scripts without referencing external libraries. These features require Microsoft 365 version 2508 or later.
Use RegExp classes included in VBE
The default RegExp classes in VBA in Office version 2508 or later contain four types of classes to define the object type: RegExp, Match, MatchCollection, and SubMatches. There are slight differences between objects created as early binding and as late binding. For more information on early and late binding, see Early and Late Binding on Microsoft Learn.
To create a variable for RegExp object type as early binding in VBA script, no external reference to external library is needed.
Early binding example
Sub RegExpEarlyBinding()
' Create a variable to hold new object.
Dim regEx As RegExp
' Assign RegExp object to the variable
Set regEx = New RegExp
….
Early binding with VBE runtime library works on Office versions 2508 or later, regardless of Windows client. It can’t run on older Office versions.
Early binding compatibility table
Office Version | Old Windows
(VBScripts enabled) |
New Windows
(VBScripts disabled/removed) |
Microsoft 365 (before 2508) | Cannot run | Cannot run |
Microsoft 365 (2508 or later) | Can run | Can run |
Late binding example
You can also create a variable for RegExp object type as late binding in VBA script just as you did before.
Sub RegExpLateBinding()
Dim regEx As Object
' Assign RegExp object to the variable
Set regEx = CreateObject("VBScript.RegExp")
…
Late binding works on Office versions 2508 or later, regardless of Windows client version and on earlier Windows versions with VBScript enabled, regardless of the Office client version. It cannot run older Office versions before 2508 on the new Windows with VBScripts disabled or removed.
Late binding compatibility table
Office Version | Old Windows
(VBScripts enabled) |
New Windows
(VBScripts disabled/removed) |
Microsoft 365 (before 2508) | Can run | Cannot run |
Microsoft 365 (2508 or later) | Can run | Can run |
Compatibility of VBA referenced VBScript RegExp libraries
VBA scripts using VBScript RegExp libraries created from Office versions before 2508 will still work with Office 2508 or later, as well as on Windows where VBScripts is enabled. If VBScripts is disabled or removed, these scripts won’t run in Office versions earlier than 2508.
Recommendations
- Upgrade to the latest Office version. Ensure you’re on a Microsoft 365 Version 2508, build 19127.20154 or later for compatibility with the new RegExp implementation.
- Use RegExp included in the VBE in new macros. Office provides RegExp functionality in VBE in version 2508 and later, already referenced by default in the VBA environment—no need to manually add vbscript.dll.
- Test your projects. Test your VBA projects in environments where VBScript is disabled to i identify any hidden dependencies.
We’d love to hear from you!
We value your feedback and suggestions. You can submit feedback directly within Office applications such as Excel by clicking the Help Improve Office smile button in the top right corner, or by navigating to Help > Feedback in the menu. You can also respond in the comments section of this blog post.
Happy coding!
Does this change apply to the LTSC version of Office?
I’ve confirmed that the Regexp class has been added to the perpetual versions of Office 2019~2024, which are the same build as 365 version, but it has not been applied to latest build of the LTSC version.
@Wenjun Gong, I check and my vbe7.dll version is 7.1.11.39.
So I don’t have the right version, but my Access version says Microsoft 365 Version 2508, build 19127.20222
Based on your article, I should have the RegExp available.
Let me know when this issue will be corrected,
I’m available if you need anything.
Thanks,
Gontran, could you please try uninstalling and reinstalling Microsoft 365 to see if that updates the vbe7.dll file? It should be refreshed automatically as part of the Office apps installation.
I did a quick repair and the RegExp library is available now, but the funny thing is my vbe version is 7.1.11.39, not .49!!!
At least it works, but not as you think it should.
Thanks Microsoft for making this append.
Now, as Karl is asking, what will happen to the other libraries in VBScript?
It would have been so easy for you would have told us in advance that you were working on integrating the RegExp.
You are stressing people for no reason.
Just tell us your plan
We understand that you probably did not tell us...
What about Scripting.FileSystemObject and Scripting.Dictionary ?
We did not make any change to Scripting.FileSystemObject and Scripting.Dictionary and they are supposed to work as expected. Did you see any issue?
Fortunately not. But Scripting and VBScript are similar. I wanted to verify that those components will not be affected.
Thanks