Office for Mac Issues

How to Fix ActiveX Component Cannot Create Object in Excel for Mac

Huda QurayshiHuda Qurayshi Oct 26, 2026 869 views

Question details

Users encounter an ActiveX component error when attempting to run a Windows-based VBA script on macOS to fetch web data.

How to Fix 'ActiveX Component Cannot Create Object' in Excel for Mac
Product
Microsoft Excel for Mac
Device & OS
macOS
Scenario
Running a VBA macro containing the CreateObject("MSXML2.XMLHTTP") function to import data from an external web service.
Observed behavior
The macro halts execution and displays the error message "ActiveX component cannot create object" because the required Windows COM components are not available on macOS.
Before you start

Verify your VBA code to locate exactly where 'CreateObject' is being called with Windows-specific libraries (like MSXML2.XMLHTTP or Scripting.Dictionary), as these will need to be rewritten for Mac compatibility.

Solution 1Recommended

Use Conditional Compilation with a Native Mac Alternative

Replace the Windows-only ActiveX HTTP request with a macOS-compatible data retrieval method, such as executing a shell curl command via AppleScript.

Since ActiveX and COM objects are proprietary to the Windows operating system, they physically cannot run on macOS. To maintain a single VBA script that works on both operating systems, you can use conditional compilation.

On a Mac, you can instruct Excel to execute an AppleScript that leverages the native macOS 'curl' command to fetch data from web services.

1
Locate the failing ActiveX code

Open Excel, press Option+F11 to open the VBA Editor, and find the line containing Set xmlhttp = CreateObject("MSXML2.XMLHTTP").

2
Wrap the existing code in a Windows conditional block

Enclose your original Windows code using the '#If Mac Then' and '#Else' compiler directives. Place the CreateObject logic under the '#Else' section.

3
Implement the AppleScript curl method for Mac

Under the '#If Mac Then' section, use the MacScript or RunAppleScript function to execute a shell command. For example: response = MacScript("do shell script ""curl 'https://your-web-service-url.com'""").

4
Parse the returned data

Ensure your VBA code takes the string response returned by the curl command and correctly parses it into your Excel worksheet.

Use Conditional Compilation with a Native Mac Alternative
Cross-Platform Compatibility: Using the #If Mac conditional block ensures that your Excel workbook remains fully functional when shared with users on Windows machines.
Free Microsoft Office alternative

Experience seamless cross-platform spreadsheet editing with WPS Office

While ActiveX components are inherently tied to Windows and limit Microsoft Excel's cross-platform VBA functionality, WPS Office provides a highly compatible and lightweight alternative for macOS users. Enjoy native support for standard spreadsheet formats and built-in features that require zero complex coding.

  1. 1. Download and Install: Visit the official WPS website to download the free macOS version of WPS Office and install it on your device.
  2. 2. Open Your Spreadsheet: Launch WPS Spreadsheet and open your existing .xlsx or .xlsm files directly without worrying about formatting loss.
  3. 3. Process Your Data: Utilize built-in data connectors and functions to process your imported web data smoothly across different operating systems.
Fully compatible with Microsoft Excel formats (.xlsx, .xls, .csv)Lightweight application optimized for excellent macOS performanceUser-friendly, tabbed interface requiring no learning curveRobust built-in tools for data analysis without relying on VBA macros
microsoft office alternative - wps office

Frequently Asked Questions

Can I install ActiveX controls on Excel for Mac?

No. ActiveX is a proprietary software framework developed by Microsoft exclusively for the Windows operating system. It cannot be installed, enabled, or run on macOS.

What does the 'ActiveX component cannot create object' error mean?

This error occurs when a VBA script attempts to instantiate an object using a library that is either unregistered, missing, or incompatible with your current operating system—such as trying to use Windows web request libraries on a Mac.

Is there a direct equivalent to MSXML2.XMLHTTP for Mac VBA?

There is no direct built-in equivalent library in Mac VBA. You must use workarounds, such as using the RunAppleScript function to execute a macOS 'curl' command via the shell to achieve HTTP request functionality.