September 9th, 2025
likeheart2 reactions

Prepare your VBA projects for VBScript deprecation in Windows

Wenjun Gong
Principal Product Manager

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

  1. 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.
  2. 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.
  3. 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!

Author

Wenjun Gong
Principal Product Manager

Wenjun Gong is a Principal PM for Office Platform at Microsoft.

12 comments

Sort by :
  • Gontran Harvey 18 hours ago

    @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,

  • Ricardo Hernández Sáez 5 days ago · Edited

    What about Scripting.FileSystemObject and Scripting.Dictionary ?

    • Wenjun GongMicrosoft employee Author

      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?

      • Ricardo Hernández Sáez 19 hours ago · Edited

        Fortunately not. But Scripting and VBScript are similar. I wanted to verify that those components will not be affected.

        Thanks

  • Sancarn · Edited

    This is really cool, can you also provide a compiler constant so we can build this into stdVBA library’s stdRegex class. Otherwise the following will fail to compile on older versions:

    set obj = new RegExp

    Ideally we would want to do something like this:

    Dim obj as Object
    #if OFFICE_2508_OR_LATER = 1 then
      set obj = new RegExp
    #else
      set obj = CreateObject("VBScript.Regexp")
    #end if
    
    • Wenjun GongMicrosoft employee Author

      If you only use late binding (set obj = CreateObject(“VBScript.Regexp”)), the script can run on both Office 2508+, and before 2508 when VBScript is enabled on Windows. Is there a particular reason you have to use early binding (set obj = new RegExp) in your script?

      • Sancarn 10 hours ago

        Ah! You’re right, my bad I didn’t fully understand the compatibility tables the first time reading through this. Makes sense, thanks for maintaining late binding! 👍

  • Gontran Harvey 6 days ago

    What append to the “MatchCollection”?

    Dim re As New VBScript_RegExp_55.RegExp ‘RegExp requires reference to “Microsoft VBScript Regular Expressions 5.5”, c:\windows\system32\vbscript.dll\3
    Dim matches As VBScript_RegExp_55.MatchCollection

    Thanks

    • Gontran Harvey 6 days ago

      Figured it out!!

      Dim matches As Object ‘just declare it as object

      It’s working but I loose the Intellisense on the MatchCollection, can you show how should I declare a MatchCollection

      Thanks

      • Wenjun GongMicrosoft employee Author

        Hi Gontran,

        The VBE contains RegExp in Office version 2508 should support Access as well. To confirm whether your vbe7.dll contains the RegExp library (version 7.1.11.49), please follow these steps:

        1. Navigate to: C:\Program Files\Microsoft Office\root\vfs\ProgramFilesCommonX64\Microsoft Shared\VBA\VBA7.1\
        2. Right-click on vbe7.dll and select Properties.
        3. Go to the Details tab and check the File version. It should show 7.1.11.49.

        Let me know if you run into any issues or need further assistance.

      • Gontran Harvey 2 days ago

        @sancarn, I just realized that even though I have the office version 2508, I don’t have the RegExp new library available in My Microsoft Access vba IDE.
        That’s why it work in late boundind and not in early
        I will wait for the next version to see if i have it.
        i have the Microsoft 365 Version 2508, build 19127.20222

      • Sancarn

        It is there…

        Sub test()
          Dim regex As RegExp: Set regex = New RegExp
          regex.Pattern = "hello(\d)"
          
          Dim captured As MatchCollection: Set captured = regex.Execute("hello2")
          Dim cap As Match: Set cap = captured.Item(0)
          Debug.Print cap.SubMatches(0)
        End Sub