Possible to add Form if VBA Project is Protected?

SusaninHouston

Active Member
Joined
Jan 13, 2005
Messages
295
I've got a model in fairly wide circulation that contains a phone number for tech support as a label field in a form. That phone number has changed, and I'd like to update that field if possible.
  • The model has regular updates applied via macro, so if it's possible to write a macro to change a field on a form, that would be the way to do it.
  • The model has several Help buttons that each call the 'ShowHelp' macro
  • The 'ShowHelp' macro displays the frmTechSupport which contains the outdated phone number

  • In a perfect world, my update macro would just change the 'Phone' field on the frmTechSupport, but since the VBA project is locked, I don't believe that's possible

  • In my update macro, I know I can redirect the 'Help' buttons to call a 'ShowHelp2' macro instead, but the part I'm wondering about is inserting a 'frmTechSupport2' with the new phone number into a Protected VBA Project. Is it possible? And if so, can anyone show me how?
Worst case, I can insert the corrected support information as a new worksheet and redirect the macHelp buttons to show that sheet instead - but I'd like to do better.

Any ideas?
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
It is possible to change data on a form in a macro. In your situation the phone number is probably a Label, which can be modified at runtime. However, if it's always the same, there is no benefit in this and it's just as easy to change it in the form design. However...
In my update macro, I know I can redirect the 'Help' buttons to call a 'ShowHelp2' macro instead
...if the project is protected you cannot do this.
the part I'm wondering about is inserting a 'frmTechSupport2' with the new phone number into a Protected VBA Project. Is it possible?
No. If the project is protected you cannot change code; you cannot even see the code.
Worst case, I can insert the corrected support information as a new worksheet and redirect the macHelp buttons to show that sheet instead
You can't do this either. The VBA project is an all-or-nothing proposition. If it is protected, all of the code for the entire workbook is protected. You can't program other buttons. (I suppose you could associate a button as a hyperlink that will take you to a worksheet without having to use VBA.)
 
Upvote 0
In my update macro, I know I can redirect the 'Help' buttons to call a 'ShowHelp2' macro instead
...if the project is protected you cannot do this.
Worst case, I can insert the corrected support information as a new worksheet and redirect the macHelp buttons to show that sheet instead
You can't do this either. The VBA project is an all-or-nothing proposition. If it is protected, all of the code for the entire workbook is protected. You can't program other buttons. (I suppose you could associate a button as a hyperlink that will take you to a worksheet without having to use VBA.)


-- Actually, you can copy in a new worksheet with pre-written sheet-level code and redirect the Help buttons (technically text boxes) to that new sheet-level code. That's been a very handy fix for me in the past. I may need to go this route again - just thought the form would be better-looking
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,823
Members
449,049
Latest member
cybersurfer5000

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