Effects of Disabling A Frame

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
3,860
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have discovered that if I disable a frame in my userform, all the controls within that frame are also disabled.
I have a routine associated with a frame click event, so there are conditions when I don't want the user to be able to click the frame. In those cases, I have the frame disabled. When the conditions are met, the frame is enabled.
But the problem is, the controls within that frame are those in which the user has to change in order to get those conditions met. With those controls disabled as a result of their host frame being disabled, I am stuck not being able to enable the frame.

Is there a workaround to this?
 

dmt32

Well-known Member
Joined
Jul 3, 2012
Messages
6,490
Office Version
  1. 2019
Platform
  1. Windows
Me being used in a standard module when I get the error.

If you want code in a standard module to work with your userform, you can pass the form as an argument to the the called procedure

example

In your Userform

VBA Code:
Private Sub CommandButton1_Click()
    MyProg Me
End Sub

where Me keyword is the userform

Procedure in a standard module

VBA Code:
Sub MyProg(ByVal Form As UserForm1)

    MsgBox Form.Name

End Sub

Where UserForm1 is your userform name OR you could just declare it as Object which is useful if code needs to work with other userforms in the same project

In the code body, you replace the userform1 name (or Me keyword if you are still trying to use it) with Form.



Dave
 

Some videos you may like

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
3,860
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Thanks Dave. I'll give that a go. Benefit being easier to read and less to type?
 

Watch MrExcel Video

Forum statistics

Threads
1,128,165
Messages
5,629,068
Members
416,363
Latest member
zaveedd

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