Overflow error on Mac when unloading userform

mcomp72

Board Regular
Joined
Aug 14, 2016
Messages
200
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2011
Platform
  1. Windows
  2. MacOS
I have a macro-enabled workbook used by around 100 people, most of them on Mac. One user is having a problem that I have never heard of before, and have never run across in my testing.

In the Workbook_Open sub, I have some userforms loading and showing under certain conditions.

After those userforms are closed (if they are ever open), I have code to make sure they are unloaded, just in case they weren't unloaded when they were first supposed to be. This code runs every time; it doesn't track whether the userform was every loaded or not.

VBA Code:
Unload UserForm1
Unload UserForm2

So far, this has worked fine on every computer that has used it (as far as I know).

However, I heard from a user today who is getting Run-time error 6: Overflow on the line Unload UserForm1. In his case, UserForm1 is never loaded. UserForm1 is definitely a userform within the file.

Since it has never caused an error before, I assumed there was no problem attempting to unload a userform that was not currently loaded.

This user is on a Mac, using BigSur and Excel 16.16.27. (He has the retail version of Excel 2016.) He also has two monitors on his computer, in case that matters. Oddly enough, he also has a Mac laptop and he tried it on that, and the file worked fine on it.

Anyone have any thoughts as to why the Overflow error might be occurring?
 

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).

mcomp72

Board Regular
Joined
Aug 14, 2016
Messages
200
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2011
Platform
  1. Windows
  2. MacOS
I think I have figured out the issue. It seems it has something to do with the fact that he has two monitors on his Mac. I made a change to some code in the Initialize sub for the UserForms (from Ron de Bruin's terrific website: Userform Position | Mac Excel Automation), and the error doesn't happen anymore. Seems odds, since no UserForms had ever loaded on his computer, but since the error isn't happening anymore, I'll assume this is what fixed it.
 
Solution

Forum statistics

Threads
1,143,677
Messages
5,720,254
Members
422,273
Latest member
linds75

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
Top