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 still covers more of desktop Excel than Office Scripts. Microsoft's Office Scripts and VBA comparison says so, and notes VBA needs no special licence.
- Office Scripts is the cloud, cross-platform option, not a drop-in successor: business or education licence, no workbook events, no sign-in to external services.
- Python in Excel is for analysis, not automation. It runs in Microsoft's cloud, with no network or computer access.
- VBScript is being retired from Windows. It affects macros that run .vbs files or use VBScript regular expressions; Microsoft 365 Version 2508 added built-in RegExp to VBA.
VBA vs Office Scripts vs Python in Excel at a glance
| VBA | Office Scripts | Python in Excel | |
|---|---|---|---|
| Language | Visual Basic for Applications | TypeScript (JavaScript also works) | Python, with libraries provided by Anaconda |
| Where it runs | Your PC, inside desktop Excel | Excel, or a Power Automate flow | Microsoft's cloud |
| Platforms | Excel for Windows and Mac; not the web | Web, Windows (Version 2210+) and Mac | Windows, Mac and web |
| Licence | Built into desktop Excel | Qualifying business or education Microsoft 365 licence plus OneDrive for Business; preview for Personal and Family | Qualifying Microsoft 365 subscription; not free or perpetual consumer licences |
| Workbook events | Yes | No | No |
| Forms and dialogs | UserForms, MsgBox, InputBox | Not in the Office Scripts API | No |
| Files on your PC | Yes | No, the workbook only | No |
| ERP and web API calls | Possible, but you write the HTTP and sign-in code | fetch inside Excel only; no OAuth | No network access |
| Runs on a schedule | Only while desktop Excel is open, for example with Application.OnTime; no cloud trigger | Yes, through Power Automate | No |
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:
- Excel for the web cannot create, run or edit VBA macros, though they stay in the file.
- Downloaded files are blocked. Since Current Channel Version 2206 (July 2022), Office for Windows blocks macros in files from the internet. See how to enable macros in Excel safely.
- VBScript is leaving Windows, which can break working macros (below).
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
- No workbook events. There is no equivalent of Worksheet_Change.
- Workbook only, no forms. A script cannot open files on your PC, and we found no UserForm or dialog API.
- No sign-in to external services. Microsoft's external calls page (January 2026) says there is no OAuth2 support and nowhere to store credentials, and calls fail when the script runs through Power Automate. So a script cannot be the connector for an ERP that needs OAuth sign-in.
- Quotas. The platform limits page lists 1,600 Run script calls per user per day and a 120-second timeout for synchronous Power Automate steps.
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:
- The code runs in isolated containers in the Microsoft Cloud, with no network access, no access to your computer, devices or account, and no user token.
- It returns values or images only, and cannot return or access the workbook's macros or VBA code.
- It reads data from cells in the workbook or from Power Query connections, so ERP data has to be in the workbook first, for example through Power Query or a connector (see Power Query for beginners).
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 task | Best fit | Why |
|---|---|---|
| Tidy a monthly export | VBA or Office Scripts | Both record your steps; Office Scripts if colleagues use the browser. |
| Data-entry form for journals or expense claims | VBA UserForm | The other two have no forms. See creating a data entry form in Excel. |
| Flag an entry when a cell changes | VBA | Office Scripts do not support Excel-level events. |
| Update a shared workbook each morning with Excel closed | Office Scripts with Power Automate | VBA needs desktop Excel running on a PC; Power Automate runs in the cloud. |
| Pull invoices or a trial balance from an ERP | Power Query or an ERP connector | No OAuth in Office Scripts; no network in Python in Excel. See ERP and Excel integration options. |
| Variance analysis or forecasting on a large table | Python in Excel | pandas and charts on data already in the workbook. |
| Combine every CSV in a folder on a shared drive | Power Query or VBA | Office Scripts and Python in Excel cannot reach your files. |
| Extract invoice numbers from descriptions | REGEX functions or VBA RegExp | Both 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
| Phase | What happens | Timing, per Microsoft |
|---|---|---|
| 1 | VBScript is a feature on demand, preinstalled and on by default in Windows 11, version 24H2. | Now |
| 2 | Off 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) |
| 3 | Removed 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
- In the VBA editor (Alt+F11), open Tools > References and see whether Microsoft VBScript Regular Expressions 5.5 is ticked.
- Press Ctrl+F, choose Current Project, and search for
VBScript.RegExp,.vbs,wscriptandcscript. - Repeat for add-ins (.xlam) and your Personal Macro Workbook.
- 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 RegExp | Office before 2508, VBScript on | Office before 2508, VBScript off | Office 2508 or later |
|---|---|---|---|
Built-in: Dim re As RegExp, no reference | No | No | Yes |
Late bound: CreateObject("VBScript.RegExp") | Yes | No | Yes |
| Reference to VBScript Regular Expressions 5.5 | Yes | No | Yes |
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.
- VBA. It can create standard modules, class modules and UserForms, write and replace procedures, add worksheet buttons wired to macros, add a custom ribbon tab and save as an .xlam add-in for you to install, and run macros. When it writes code with its write and replace tools, a static linter with 142 inspections undoes the write if Error-level findings appear. See the VBA macros and ribbon tutorial.
- Moving off VBScript. With your permission it can read the code in every module to find VBScript RegExp code and .vbs or wscript calls (it cannot list ticked references, so check Tools > References yourself), and rewrite RegExp code to the built-in classes. You untick the old reference yourself; the linter does not know your Office build, so run Debug > Compile VBAProject on each version your team uses. An optional test on a hidden copy of a saved workbook compile-checks a change and can run test macros, which really execute (it saves your workbook first if there are unsaved changes); it is a check, not a guarantee.
- Ledgers. Two-way connections to QuickBooks Online, Xero, Zoho Books, Odoo and FreshBooks, writing through an Excel staging sheet. Posting live, and updating, voiding or deleting records, needs a click on a confirmation card; drafts and master data such as customers and items are created without one.
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.