Variable User Form Name

All the examples of UserForms have referred to the UserForm by its programmatic name (such as frmProgress). There can be situations where you need to run a number of different forms with the same code, or you don't know the programmatic name of the UserForm before the code is executed. In these cases, you need to be able to assign the UserForm name to a variable and use the variable as an argument. The following code allows you to do this:

FormName = "frmPersonal" VBA.UserForms.Add(FormName).Show

0 0

Post a comment