Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Showing a Userform with VBA Code 2

Status
Not open for further replies.

peterpcu

MIS
Sep 15, 2005
31
0
0
GB
Hi

I have been using:-

Screen1.show

to display a typical userform.

(Where Screen1 is the name of an existing userform)

Does anyone have any suggestions on how I can display the same form by using a userform name (eg 'Screen1' which is held in say cell A1 of a worksheet?

Regards

Pete

 
You can:

UserForms.Add("Screen1").Show

combo
 
combo,

That doesn't work for me... "Object Required" error.


Regards,
Mike
 
Mike,
I get the same error when there is no form with this name in the project from which the code runs, otherwise it works.

combo
 
The following ought to work

vba.UserForms.Add(Cells(1, 1)).Show
 
Combo,

Yep, got it. Curious as to the OP's reason/aim.


Regards,
Mike
 
Hi there,

Many thanks for the suggestions which worked an absolute treat! - I was indeed spoilt for choice.

Just to answer Mike's curiosity, I may have mentioned before that I am building a userform generator which builds userforms dynamically based on outputs from a database. Its going well..thanks to help from this great forum.

Regards

Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top