vba code woks on a PC but not a MAC

mhorstman

New Member
Joined
Feb 26, 2018
Messages
10
Hi,

I'm looking for some help on why my code is working on a PC but won't work on a MAC. I have a sub that executes when the user uses the paste function to auto-format cells based on the data pasted in. I can't figure out why it won't work on a MAC. I thought it was because the control ID number was going to be different between the two OSs. I confirmed that it is 128 on both. Any help would be greatly appreciated.

Dim undolist As String
undolist = Application.CommandBars("Standard").FindControl(ID:=128).List(1)
If Left(undolist, 5) = "Paste" Then

The rest of the code after this is just the instructions for formatting.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
I've looked it up and I don't think this code works on a MAC. On the MAC, it looks like the object type cannot be retrieved correctly.

On PC
Debug.Print TypeName(Application.CommandBars("Standard").FindControl(ID:=128)) -> CommandBarComboBox
On Mac
Debug.Print TypeName(Application.CommandBars("Standard").FindControl(ID:=128)) -> CommandBarControl

On Mac, I don't think I can access the List object of a member of CommandBarComboBox.
 
Upvote 0
On Mac
Dim UndoList As CommandBarComboBox
Set UndoList = Application.CommandBars("Standard").FindControl(ID:=128)

-> UndoList is Nothing
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,181
Members
452,615
Latest member
bogeys2birdies

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