Excel VBA - migrating from Windows to macOS

kreutz

New Member
Joined
Nov 20, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I'm moving many Excel .xlsm files from Windows to an M2 MacBook Pro running Excel for Mac (Microsoft 365) and am wondering: 1) how much of my VB code will break, and 2) if the code might execute differently, but silently, i.e. generating incorrect results without flagging the incompatibility. I found one minor discrepancy: spaces around the exponentiation operator (Redirecting).


Has anyone compiled a list of differences between Windows and macOS Excel VBA? Any suggestions, from macro to micro? Many thanks in advance!
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
You have to have spaces around the exponentation operator in Windows also. This is just standard VBA syntax, which does not vary.

The file separator for Windows is "\" and the separator for some Mac versions (not versions of Excel, versions of MacOS) it is ":". It is safer to use Application.PathSeparator rather than hard-coding it.

Any code that uses Windows API libraries will have to be rewritten. I am not familiar with what library calls are available for MacOS.

There is also a built-in sub that has an argument that is not supported on Mac. It has been a long time since I've seen it and I can't remember what it was, and I can't find my notes on it. But it is related to file system calls. It will raise an error.

Honestly, the best way to find out how much of your code will break is to run it and see what breaks. I have never seen a case where code executes differently but silently; that doesn't mean it's not possible, but unlikely.
 
Upvote 0
You have to have spaces around the exponentation operator in Windows also. This is just standard VBA syntax, which does not vary.

The file separator for Windows is "\" and the separator for some Mac versions (not versions of Excel, versions of MacOS) it is ":". It is safer to use Application.PathSeparator rather than hard-coding it.

Any code that uses Windows API libraries will have to be rewritten. I am not familiar with what library calls are available for MacOS.

There is also a built-in sub that has an argument that is not supported on Mac. It has been a long time since I've seen it and I can't remember what it was, and I can't find my notes on it. But it is related to file system calls. It will raise an error.

Honestly, the best way to find out how much of your code will break is to run it and see what breaks. I have never seen a case where code executes differently but silently; that doesn't mean it's not possible, but unlikely.
Many thanks for your help!
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,212
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top