How to Fix ActiveX Component Cannot Create Object in Excel for Mac
Question details
Users encounter an ActiveX component error when attempting to run a Windows-based VBA script on macOS to fetch web data.

- 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.
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.
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.
Open Excel, press Option+F11 to open the VBA Editor, and find the line containing Set xmlhttp = CreateObject("MSXML2.XMLHTTP").
Enclose your original Windows code using the '#If Mac Then' and '#Else' compiler directives. Place the CreateObject logic under the '#Else' section.
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'""").
Ensure your VBA code takes the string response returned by the curl command and correctly parses it into your Excel worksheet.

Utilize Excel's Built-in Power Query or Web Query
Bypass VBA entirely by using Excel's native external data import features, which are natively supported on Excel for Mac.
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. Download and Install: Visit the official WPS website to download the free macOS version of WPS Office and install it on your device.
- 2. Open Your Spreadsheet: Launch WPS Spreadsheet and open your existing .xlsx or .xlsm files directly without worrying about formatting loss.
- 3. Process Your Data: Utilize built-in data connectors and functions to process your imported web data smoothly across different operating systems.

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.




