Link VBA code to form control button?

leopardhawk

Well-known Member
Joined
May 31, 2007
Messages
609
Office Version
  1. 2016
Platform
  1. Windows
Hello forum friends, I have a complex workbook that runs perfectly on a Windows PC but because it contains two ActiveX buttons that launch user data input forms, one for personal data and the other for financial data, the workbook cannot be used on a Mac PC.

I have discovered in another post that if I remove the ActiveX buttons and instead use Form Control buttons, that my workbook could function on a Mac PC as well. I have created two Form Control buttons to replace the ActiveX controls but my problem is, how do I link the two new form control buttons to the existing VBA code that actually brings up the UserForms so users can input their data? When I right-click the new form control buttons, I have an option to 'Assign Macro' but I'm not sure what to do at this point. I'm pretty sure a Macro isn't the same as VBA code (geesh, what a noob I am) but what can I do so that users will still be able to use the workbook on a Mac PC?

Any suggestions are much appreciated. Thanks!
 

GWteB

Well-known Member
Joined
Sep 10, 2010
Messages
2,103
Office Version
  1. 2013
Platform
  1. Windows
You are welcome! In answer to your questions:
1) After assigning them to a button it's ok to change the subs declaration to Private, they will be invoked on button click anyway.
2) That depends on the actual macro settings of each individual user. If this setting needs to be adjusted, it only needs to be done once, and not for each workbook separately. If it's set to "Disable all macros with notification", which is the setting I and my co-workers use, user is able to run macros, but for files not yet registered as trusted, user has to give explicit permission to run macros when opening an .xlsm workbook (yellow warning bar).
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,143,623
Messages
5,719,804
Members
422,245
Latest member
Kebad

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