Office Scripts vs VBA vs Python in Excel: Is VBA Being Replaced, and What VBScript Deprecation Means (2026)

If you are weighing Office Scripts vs VBA vs Python because you heard VBA is on the way out: in September 2026, Microsoft has not announced a VBA replacement. Office Scripts and Python in Excel do some jobs better, with limits that matter to finance teams. What is being retired is VBScript, a Windows component some macros depend on, and its most common use, regular expressions, now has a built-in fix.

Last checked: 16 September 2026, against sources we opened that day. We make HISAB 360, an AI assistant add-in for Windows desktop Excel that can read and write VBA, so it comes last, with its limits. Looking for the VBA Replace function instead? See Microsoft's Replace function reference.

Is VBA being replaced? The short answer

No. Microsoft has not announced any retirement of VBA in Excel for Windows.

VBA vs Office Scripts vs Python in Excel at a glance

VBAOffice ScriptsPython in Excel
LanguageVisual Basic for ApplicationsTypeScript (JavaScript also works)Python, with libraries provided by Anaconda
Where it runsYour PC, inside desktop ExcelExcel, or a Power Automate flowMicrosoft's cloud
PlatformsExcel for Windows and Mac; not the webWeb, Windows (Version 2210+) and MacWindows, Mac and web
LicenceBuilt into desktop ExcelQualifying business or education Microsoft 365 licence plus OneDrive for Business; preview for Personal and FamilyQualifying Microsoft 365 subscription; not free or perpetual consumer licences
Workbook eventsYesNoNo
Forms and dialogsUserForms, MsgBox, InputBoxNot in the Office Scripts APINo
Files on your PCYesNo, the workbook onlyNo
ERP and web API callsPossible, but you write the HTTP and sign-in codefetch inside Excel only; no OAuthNo network access
Runs on a scheduleOnly while desktop Excel is open, for example with Application.OnTime; no cloud triggerYes, through Power AutomateNo

Is VBA dead? Is it still used and relevant in 2026?

No. VBA is still used and still relevant for work that lives in desktop Excel. Microsoft's comparison positions VBA for desktop solutions and Office Scripts for cross-platform, cloud-based ones. That 2023 page is positioning, not a promise; we found no Microsoft statement guaranteeing VBA indefinitely, or retiring it.

In finance, VBA remains the practical choice for checking entries as they are typed, data-entry forms and combining files from a network drive. New to macros? Start with what a macro in Excel is. Three changes explain the "VBA is dead" talk:

Office Scripts vs VBA: what Office Scripts can and cannot do

Office Scripts are TypeScript scripts, recorded or written in the code editor and stored in OneDrive. Where they beat VBA: browser and Mac users can run them, and a Power Automate flow can run one on a schedule with Excel closed (VBA has no Power Automate connector).

Office Scripts limits that matter to finance teams

Python vs VBA: what Python in Excel is, and is not

Python in Excel runs Python from a cell and returns values or charts, a real step up for analysis such as reshaping a ledger export. Microsoft's data security page sets the boundaries:

Availability. Per Microsoft's availability page, business and enterprise users get it on Windows from Current Channel Version 2408 (Build 17928.20114) and on Mac from Version 16.96. Free and perpetual consumer licences, device-based licences and shared computer activation are not supported, and the introduction page says you need internet access. Our reading, not Microsoft's: without forms, events, file access or API calls, it complements VBA rather than replacing it.

What about Python outside Excel: xlwings, openpyxl and PyXLL?

Many "VBA vs Python" searches mean Python on your PC. openpyxl is a Python library that reads and writes .xlsx and .xlsm files. xlwings, a BSD-licensed library, calls Python from Excel and Excel from Python on Windows and Mac. PyXLL is a commercial Excel add-in for writing worksheet functions and macros in Python. Usually the PC running the code needs Python and the packages installed. Microsoft's Office Add-ins (HTML, CSS, JavaScript) run on Windows, Mac, iPad and the web, but target professional developers; that page places VBA with end users.

Which tool fits which finance task?

For deciding what to automate first, see Excel automation for finance teams.

Finance taskBest fitWhy
Tidy a monthly exportVBA or Office ScriptsBoth record your steps; Office Scripts if colleagues use the browser.
Data-entry form for journals or expense claimsVBA UserFormThe other two have no forms. See creating a data entry form in Excel.
Flag an entry when a cell changesVBAOffice Scripts do not support Excel-level events.
Update a shared workbook each morning with Excel closedOffice Scripts with Power AutomateVBA needs desktop Excel running on a PC; Power Automate runs in the cloud.
Pull invoices or a trial balance from an ERPPower Query or an ERP connectorNo OAuth in Office Scripts; no network in Python in Excel. See ERP and Excel integration options.
Variance analysis or forecasting on a large tablePython in Excelpandas and charts on data already in the workbook.
Combine every CSV in a folder on a shared drivePower Query or VBAOffice Scripts and Python in Excel cannot reach your files.
Extract invoice numbers from descriptionsREGEX functions or VBA RegExpBoth built into Microsoft 365; see below.

VBScript deprecation: the timeline and what it means for VBA

VBScript, the language behind .vbs files, is deprecated in Windows, not Office. Microsoft's Windows deprecated features list (updated August 2026) records the announcement as October 2023.

Is VBScript a dead language? For new work, effectively yes. Microsoft's timeline post names JavaScript and PowerShell as alternatives and recommends PowerShell for task automation. Small .vbs helpers called from macros can usually move into VBA.

The three phases, and where Microsoft's dates differ

PhaseWhat happensTiming, per Microsoft
1VBScript is a feature on demand, preinstalled and on by default in Windows 11, version 24H2.Now
2Off by default; can be switched back on under Settings > System > Optional features.Around 2027, per the Windows IT Pro Blog (22 May 2024); approximately 2026 or 2027, per the Microsoft 365 Developer Blog (9 September 2025)
3Removed from future Windows releases, DLLs included. Dependent projects stop working.No date announced

The deprecated features list gives no dates. A Microsoft MVP's June 2026 community post expects the switch-off by autumn 2027, but that is not a Microsoft announcement. Plan for 2027: phase 2 breaks affected macros on any PC where nobody switches VBScript back on.

Which VBA code is affected?

Microsoft names two patterns: VBA that runs an external .vbs script (for example through wscript.exe), and VBA that references a VBScript type library, most often Microsoft VBScript Regular Expressions 5.5. In the developer blog post's comments, its Microsoft author confirmed that Scripting.Dictionary and Scripting.FileSystemObject were not changed. VBA itself does not appear on the Windows deprecated features list.

VBScript deprecation alert (Event ID 4096): what it means and how to fix it

It is an Event Viewer entry, VBScriptDeprecationAlert, Event ID 4096, whose message begins "VBScript is scheduled for deprecation" and gives the process tree and call stack of whatever used VBScript (documented in the MVP post above, not on Microsoft Learn). It is a warning, not a macro error. Windows and Office licensing scripts also use VBScript, so check the process named; if it is Excel, check your workbooks. To find entries, filter Event Viewer on Event ID 4096. Fix it by removing the dependency; clearing the event changes nothing.

How to check your workbooks

  1. In the VBA editor (Alt+F11), open Tools > References and see whether Microsoft VBScript Regular Expressions 5.5 is ticked.
  2. Press Ctrl+F, choose Current Project, and search for VBScript.RegExp, .vbs, wscript and cscript.
  3. Repeat for add-ins (.xlam) and your Personal Macro Workbook.
  4. Test on a PC with VBScript switched off, as Microsoft recommends; its detection strategies post gives IT the DISM command, to try in a test environment first.

VBA regex without VBScript: built-in RegExp in Microsoft 365 Version 2508

From Microsoft 365 Version 2508 (Build 19127.20154) on Windows, VBA includes four regex classes, RegExp, Match, MatchCollection and SubMatches, according to the Microsoft 365 Developer Blog. Early-bound code no longer needs a library reference.

Which regex code runs where

From the post's compatibility tables and notes:

How your code gets RegExpOffice before 2508, VBScript onOffice before 2508, VBScript offOffice 2508 or later
Built-in: Dim re As RegExp, no referenceNoNoYes
Late bound: CreateObject("VBScript.RegExp")YesNoYes
Reference to VBScript Regular Expressions 5.5YesNoYes

The real risk is an Office build older than 2508 once VBScript is off. The post does not say whether perpetual or LTSC versions include built-in RegExp, so check each version your team runs (File > Account > About Excel). All on 2508 or later: use the built-in classes. Mixed team: late binding runs in as many combinations as the old reference and needs no reference to be set, so it is the simplest bridge while you upgrade.

Migration example: extract invoice references and clean descriptions

This macro assumes a sheet named Bank with descriptions in column B from row 2. It writes references such as "inv 10452" to column C as INV-10452 (clearing C when nothing matches), and the description with repeated spaces collapsed to column D as text. On Version 2508 or later, first untick Microsoft VBScript Regular Expressions 5.5 under Tools > References, then run Debug > Compile VBAProject. If Compile reports "User-defined type not defined" on RegExp, try a Quick Repair of Microsoft 365; in the post's comments, that fixed it for one user after the author suggested reinstalling.

Option Explicit

' Built-in RegExp: Microsoft 365 Version 2508 or later on Windows.
Public Sub TagInvoiceReferences()
    Dim ws As Worksheet
    Dim reInvoice As RegExp
    Dim reSpaces As RegExp
    Dim found As MatchCollection
    Dim lastRow As Long
    Dim r As Long
    Dim txt As String

    On Error GoTo Failed
    Set ws = ThisWorkbook.Worksheets("Bank")
    lastRow = ws.Cells(ws.Rows.Count, "B").End(xlUp).Row

    Set reInvoice = New RegExp
    reInvoice.Pattern = "\bINV[- ]?(\d{4,6})\b"
    reInvoice.IgnoreCase = True

    Set reSpaces = New RegExp
    reSpaces.Pattern = "\s{2,}"
    reSpaces.Global = True

    For r = 2 To lastRow
        If Not IsError(ws.Cells(r, "B").Value) Then
            txt = CStr(ws.Cells(r, "B").Value)
            ws.Cells(r, "D").NumberFormat = "@"
            ws.Cells(r, "D").Value = reSpaces.Replace(Trim$(txt), " ")
            Set found = reInvoice.Execute(txt)
            If found.Count > 0 Then
                ws.Cells(r, "C").Value = "INV-" & found.Item(0).SubMatches(0)
            Else
                ws.Cells(r, "C").ClearContents
            End If
        End If
    Next r
    Exit Sub

Failed:
    MsgBox "Could not tag invoice references: " & Err.Description, vbExclamation
End Sub

found.Item(0).SubMatches(0) is the digits captured by the brackets in the first match. Replace with Global = True swaps every run of two or more whitespace characters for one space; the text format stops "00123" becoming a number. Microsoft's post is not a full member reference, so test existing patterns on a copy first.

A late-bound version for mixed Office versions

Per Microsoft's tables, this runs on Version 2508 or later whatever the VBScript state, and on older builds while VBScript is enabled. Put it in a standard module and use =FirstMatch(B2, "INV[- ]?\d{4,6}"). Static creates the regex object once, not on every recalculation.

Option Explicit

' Returns the first match of regexPattern in sourceText, or #N/A if none.
Public Function FirstMatch(ByVal sourceText As String, ByVal regexPattern As String) As Variant
    Static re As Object
    Dim found As Object

    On Error GoTo Failed
    If re Is Nothing Then Set re = CreateObject("VBScript.RegExp")
    re.Pattern = regexPattern
    re.IgnoreCase = True
    re.Global = False

    Set found = re.Execute(sourceText)
    If found.Count > 0 Then
        FirstMatch = found.Item(0).Value
    Else
        FirstMatch = CVErr(xlErrNA)
    End If
    Exit Function

Failed:
    FirstMatch = CVErr(xlErrValue)
End Function

Regex in Excel without VBA

For a formula-only fix, Excel for Microsoft 365 has REGEXTEST, REGEXEXTRACT and REGEXREPLACE; the REGEXTEST page says all three use the PCRE2 flavour. For example, =REGEXEXTRACT(B2, "INV[- ]?\d{4,6}", 0, 1). The final 1 makes the match case-insensitive, like IgnoreCase = True; the REGEXEXTRACT page says the default is case-sensitive. Test each pattern in both places.

Should you move your macros off VBA?

Usually not wholesale: move only the jobs the task table above gives to Office Scripts or Python. Fix now, whatever you decide: VBScript regex references, .vbs calls, and any macro that already misbehaves (see our Excel macro not working checklist). For ledger data, a connector usually beats all three scripting tools; see connecting QuickBooks and Xero to Excel.

How HISAB 360 fits: AI help with VBA in desktop Excel

HISAB 360 is an AI assistant add-in for Windows desktop Excel whose AI can read and write the VBA in macro-enabled workbooks.

The limits: Windows desktop Excel only. Most macro tools are off by default: to edit code you switch on HISAB's Edit and Run macro permissions, tick Excel's Trust access to the VBA project object model, and use a macro-enabled file (.xlsm, .xlsb, .xlam or .xltm). The linter is not the VBA compiler and does not fix code itself. Apart from undoing a write the linter rejects, there is no automatic rollback, so export modules before large edits. There is no supported VBA API for posting to an ERP. Not for: teams working mainly in the browser or on Mac, or automation that must run in the cloud with Excel closed.

Frequently asked questions

Is VBA being deprecated?

No. Microsoft has not announced any retirement of VBA in Excel for Windows, and its documentation still describes VBA as the desktop option with more complete Excel coverage than Office Scripts. What is deprecated is VBScript, a separate Windows component, which affects VBA only where macros run .vbs files or use VBScript regular expressions.

Is VBA still relevant in 2026?

Yes, for automation inside desktop Excel. Of Microsoft's three options, only VBA offers workbook events, UserForms and access to files on your PC, and it needs no special licence. Office Scripts suits browser users and Power Automate schedules; Python in Excel suits cloud analysis. Many teams use VBA alongside one or both.

Is VBScript scheduled to be deprecated?

It already is. Microsoft announced it in October 2023. In Windows 11, version 24H2, VBScript is an optional feature, on by default. Microsoft says it will be off by default around 2027 (a September 2025 Microsoft post says approximately 2026 or 2027) and later removed; no removal date is announced.

What is replacing VBScript?

Microsoft points to PowerShell and JavaScript. For VBA users, the most common dependency is regular expressions: Microsoft 365 Version 2508 (Build 19127.20154) added built-in RegExp, Match, MatchCollection and SubMatches classes to VBA, so early-bound regex code no longer needs the VBScript library. Small .vbs helpers can usually move into VBA.

How do I use regex in VBA without the VBScript reference?

On Microsoft 365 Version 2508 or later for Windows, untick Microsoft VBScript Regular Expressions 5.5 under Tools, References, declare Dim re As RegExp and Set re = New RegExp, then set Pattern, IgnoreCase and Global and call Execute, Test or Replace. On older builds, CreateObject("VBScript.RegExp") works while VBScript is enabled in Windows.

Can Office Scripts replace VBA?

For some jobs. Office Scripts run in Excel for the web, Windows and Mac and work with Power Automate. But they cannot respond to workbook events, show forms, reach files outside the workbook or sign in with OAuth, and need a business or education Microsoft 365 licence. Macros relying on those should stay in VBA.

Which is harder, VBA or Python?

For small tasks the languages are similarly approachable; the environment differs. VBA is built into desktop Excel, and the macro recorder writes starter code. Python in Excel needs a qualifying Microsoft 365 plan and returns results only to cells; Python on your PC needs installing. Python pays off for heavy analysis, VBA for automating a workbook.

Try HISAB 360 on your own workbook

HISAB 360 is an AI assistant inside Windows desktop Excel for accountants and finance teams. It connects two-way to QuickBooks, Xero, Zoho Books, Odoo and FreshBooks. The 15-day trial is the full product, no card required.

Start free → See pricing