[Excel for Mac] Checkboxes causing crash when referenced

gravanoc

Active Member
Joined
Oct 20, 2015
Messages
351
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
I have a situation where this code breaks Excel:

VBA Code:
Sub ArchiveSheet()
    Dim chkBox As CheckBox
    Dim wks As Worksheet
    Dim rngArchive As Range
    Dim rngMessage As Range
    Dim shtNo As Long, i  As Long
    Dim defVal(0 To 2) As Variant
 
    Call EventStop

    Set wks = ActiveSheet
    Set chkBox = wks.CheckBoxes(Application.Caller)  ' Crashes to desktop here
    . . . more code

It was prior to the 3rd crash that I identified which line of code was responsible, setting a variable referencing a form checkbox that has the above macro assigned to it. Normally,
this is fine on Windows Excel. I looked up Ron de Bruin's macexcel.com website, and an article on shapes infers that the Checkboxes collection is usable, so perhaps something else is wrong?
The other possibility is that Application.Caller is causing the problem. Any ideas?

Edit: changed the Dim chkBox as Object to "As CheckBox", since that is what it said when the crash happened.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Try this alteration :

VBA Code:
Set chkBox = wks.CheckBoxes(Application.Caller).Name
 
Upvote 0

Forum statistics

Threads
1,223,898
Messages
6,175,272
Members
452,628
Latest member
dd2

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