VBA Excel run in Wins but not MAC OS

arwyn

New Member
Joined
Jul 13, 2011
Messages
1
Hi, I have an old VB Excel marco that rans fine in Wins but has Errors when you run it on a Mac. What are the key differences between the 2 environments? Do you have to maintain 2 versions?

thanks.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
The Mac version 2008 I think has no VBA built in, it uses AppleScript. Beforehand, it did have VBA, and I've read somewhere (but I'm not sure) that the latest Mac version again has VBA support.
If you need to support Office 2008 for Mac, you will need a separate version for sure...
 
Upvote 0
Depending on the version of Mac Excel, the major difficulty is that Mac does not support ActiveX controls.

What errors are you getting? Does the code use constants like "/" for path separators, etc.?
 
Upvote 0
There are small differences in the object model, and Excel 2004 and prior on the Mac ran VBA5 (equivalent to Office 97 in Windows) rather than VBA6. Excel 2011 does now have VBA6 though there are still some differences in the OM.
 
Upvote 0
There are actually still huge differences in VBA for Excel 2011 and VBA for Windows Excel. What you need to do is run the code in both environments, see where it fails in one or the other, and modify the code to work both ways, or use If/Then/Else to specify different execution paths for the different operating systems.
 
Upvote 0
You can use conditional compiling
Code:
#If Mac Then
    MsgBox "I'm a mac"
#Else
    MsgBox "i'm not"
#End If

The difference between conditional compiling and branching depending on Application.Version is that in branching all the statments are compiled, possibly causing Object Not Found errors. Conditional Compiling does not compile the statments in the wrong branch, so those errors are avoided.
 
Upvote 0
Good point, I'd forgotten about conditional compilation.

The ultimate solution will require a combination of approaches.
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,682
Members
452,937
Latest member
Bhg1984

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