aliases

  • Thread starter Thread starter Steven Revell
  • Start date Start date
S

Steven Revell

Hi all,

What i want to do is called a form from a module but i
don't want to have to write the forms name each time. I
was wondering if i could write

formname = frm

and then just type frm each time?

Thanks in advance,

Steven
 
Hi all,

What i want to do is called a form from a module but i
don't want to have to write the forms name each time. I
was wondering if i could write

formname = frm

and then just type frm each time?

Thanks in advance,

Steven

Nope, you can't do that. I tried this code:

Sub test()

Dim frm

frmOne.Name = frm

Debug.Print frm.TextBox1.Value

frm.Name = frmOne

End Sub

But it gave me an arror that the 'function' or 'interface' was marked as
'restricted'. Perhaps it is possible to fool Excel, but I do not know how.

SL
 
Close , the syntax is

Dim frm as UserForm
set frm=formname
Nope, you can't do that. I tried this code:

Sub test()

Dim frm

frmOne.Name = frm

Debug.Print frm.TextBox1.Value

frm.Name = frmOne

End Sub

But it gave me an arror that the 'function' or 'interface' was marked as
'restricted'. Perhaps it is possible to fool Excel, but I do not know how.


Your code failed because a a userform is an object , the following code
DOES work

Dim frm As UserForm
Set frm = frmONE
Debug.Print frm.TextBox1.Value

Note the form property Name is read only so you cannot rename a
Userform with it


Keith
 
Back
Top