ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   UserForm doesn't show? (https://www.excelbanter.com/excel-programming/445037-userform-doesnt-show.html)

Charlotte E.[_3_]

UserForm doesn't show?
 
Why doesn't this work:

Dim MyUF As UserForm
Set MyUF = UserForm1
MyUF.Show

???


How to set a userform as a variable???


CE

GS[_2_]

UserForm doesn't show?
 
Charlotte E. explained :
Why doesn't this work:

Dim MyUF As UserForm
Set MyUF = UserForm1
MyUF.Show

???


How to set a userform as a variable???


CE


A UserForm doesn't have a Show method (according to the ObjectLib).

An Object Set to a UserForm does have a Show method.

Example:
Dim MyUF As Object
Set MyUF = UserForm1
MyUF.Show

However, why not just...

UserForm1.Show
...so you don't have the overhead of storing a ref to it in a variable?

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc



Charlotte E.[_3_]

UserForm doesn't show?
 
Thanks :-)

I need my macro to open different userforms on different conditions, and
then perform some actions on them - much easier this way...

CE


Den 11.10.2011 04:49, GS skrev:
Charlotte E. explained :
Why doesn't this work:

Dim MyUF As UserForm
Set MyUF = UserForm1
MyUF.Show

???


How to set a userform as a variable???


CE


A UserForm doesn't have a Show method (according to the ObjectLib).

An Object Set to a UserForm does have a Show method.

Example:
Dim MyUF As Object
Set MyUF = UserForm1
MyUF.Show

However, why not just...

UserForm1.Show
...so you don't have the overhead of storing a ref to it in a variable?


GS[_2_]

UserForm doesn't show?
 
Charlotte E. explained :
Thanks :-)

I need my macro to open different userforms on different conditions, and then
perform some actions on them - much easier this way...

CE


You're welcome!

Depending on the situation.., I use a single userform that changes
according to context via setting the Visible property of frames. I
prefer this to having multiple userforms that only add unnecessary
size/overhead to projects. All frames are managed via a 'ShowPage'
procedure that resets things to the context of the current AppMode
setting.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc




All times are GMT +1. The time now is 10:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com