logo
search
VBA & Macro Problems

How to Fix VBA Error 438 in JSON Parsers on Windows 11

Rana GarciaRana Garcia Sep 27, 2026 870 views

Question details

The user needs to fix a VBA Error 438 occurring during JSON parsing, which prevents macros from running properly after a recent Windows update.

Fixing VBA Error 438 in Excel JSON Parsers After a Windows 11 Upgrade
Product
Microsoft Excel / VBA
Device & OS
Windows 11 (Build 26100)
Scenario
Running an Excel VBA macro that uses a JSON parser to iterate through keys using a For Each loop.
Observed behavior
The macro throws 'Error 438: Object doesn't support this property or method' because the returned JSON keys object no longer supports For Each enumeration on newer Windows 11 builds.
Before you start

Before modifying your macro code, identify which specific JSON parsing script is throwing the error and ensure your workbook is saved to prevent accidental code loss.

Solution 1Recommended

Convert JSON Keys to an Array to Avoid Enumeration Errors

Modify your VBA code to convert the returned keys object into a comma-delimited string, split it into an array, and iterate using index numbers instead of a For Each loop.

In newer versions of Windows 11 (such as build 26100), certain COM objects returned by external JSON parsers lose their compatibility with the standard 'For Each' enumeration method in VBA. Bypassing the object enumeration by converting the data into a standard VBA array will permanently resolve this compatibility issue.

1
Open the VBA Editor

Press ALT + F11 in Excel to open the Visual Basic for Applications (VBA) Editor, and locate the module containing your JSON parsing code.

2
Locate the problematic loop

Find the line of code using a 'For Each' loop to iterate through the JSON keys (e.g., For Each key In KeysObject), which is where Error 438 is triggered.

3
Convert the object to a string

Declare a string variable and convert the keys object into a comma-separated string using the CStr function. For example: a = CStr(KeysObject).

4
Split the string into an array

Declare an array variable and populate it by splitting the newly created string. Use the code: KeysArray = Split(a, ",").

5
Update the loop structure

Replace your old 'For Each' loop with a standard For loop that iterates through the array indices. Use: For i = 0 To UBound(KeysArray). Inside the loop, reference the keys using KeysArray(i).

Convert JSON Keys to an Array to Avoid Enumeration Errors
Verified Workaround: This array-splitting method ensures your JSON parser remains functional across all Windows 10 and Windows 11 builds without relying on OS-level object enumeration features.

Run and Edit VBA Macros Seamlessly in WPS Office

WPS Spreadsheets provides robust built-in support for VBA macros, offering a highly stable environment for running complex scripts and JSON parsers without the unexpected COM object glitches sometimes seen in other software updates.

  1. 1. Download WPS Office: Download and install the latest version of WPS Office, ensuring you select the package that includes VBA support.
  2. 2. Open your macro workbook: Launch WPS Spreadsheets and open your existing .xlsm or .xlsb workbook.
  3. 3. Access the VBA Editor: Navigate to the 'Developer' tab on the top ribbon and click on 'Visual Basic' to open the familiar VBA Editor interface.
  4. 4. Apply the array fix: Locate your JSON parser module and easily apply the CStr and Split array conversion fix.
  5. 5. Run your modified macro: Save your code and run the macro to verify that the JSON data is parsed perfectly without encountering Error 438.
Fully compatible with Microsoft Excel VBA code, macros, and standard objects.Stable macro execution environment across various Windows versions.Lightweight installation with high processing speed for heavy scripts.Free to use for basic spreadsheet editing and data formatting.
microsoft office alternative - wps office

Frequently Asked Questions

What does VBA Error 438 mean?

VBA Error 438, 'Object doesn't support this property or method,' occurs when a script tries to execute a method or access a property that the specific object does not possess. In this scenario, it happens when trying to use a 'For Each' loop on a JSON object that is not recognized as an enumerable collection.

Why did this VBA error only appear after a Windows 11 upgrade?

Certain Windows 11 updates, specifically builds like 26100, introduced underlying changes to system libraries and COM objects. This caused previously enumerable objects returned by some third-party JSON parsers to lose their 'For Each' compatibility, triggering the error.

Can I still use the For Each loop for other objects in VBA?

Yes, standard VBA collections, arrays, and native Excel objects like ranges or worksheets still fully support 'For Each' enumeration. This error is strictly localized to certain external dictionary or JSON parser objects.

How does the Split method bypass this issue?

By using CStr(), you force the object to output its default string representation, which is typically a comma-separated list of keys. The Split() function converts this text string into a native VBA zero-based array, which VBA can always iterate through safely using a standard For loop.