How to suppress compile errors generated from ActiveX code being present on MAC

MoshiM

Active Member
Joined
Jan 31, 2018
Messages
439
Office Version
  1. 2016
Platform
  1. Windows
I have a workbook with code referencing activex objects that isn't supposed to be ran on if the user is on Mac, however after the user gets out of the initial read only mode upon receiving the document, ActiveX objects are deleted. Trying to run certain macros will then result in compile errors not run time errors. Is there a way to suppress these errors ?

Code:
With Application


    If .OperatingSystem Like "*Mac*" Then
    
        Navigation.Show
        
    Else
    
        .Run "'" & ThisWorkbook.Name & "'!Update_List"
        
         HB[COLOR=#ff0000].Sheet_Selection.Text[/COLOR] = "Select Sheet"


        'HB is a worksheet,  Sheet_selection is an activex combobox


    End If

end with
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Conditional compilation is indicated by the leading #:

Code:
#If Mac Then
  ' do nothing
[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=Else]#Else[/URL] 
  ' ActiveX code that's going to crash goes here
[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=End]#End[/URL]  If

Of course, the best approach is to eliminate the ActiveX objects in favor of less sexy but more robust Form controls.
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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