Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
anyway to set a userform name to a variable i can use with <variable name
instead of with userform1, with userform2, etc? -- Gary |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Don't think so, what are you trying to accomplish? Actually i'm not even sure
of the question, are you just wanting to change the name of the userform? or set the name to a variable? "Gary Keramidas" wrote: anyway to set a userform name to a variable i can use with <variable name instead of with userform1, with userform2, etc? -- Gary |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is this the sort of thing you had in mind
Dim oUserForm As Object On Error GoTo err Set oUserForm = UserForms.Add("Userform1") '... With oUserform .Show -- --- HTH Bob (change the xxxx to gmail if mailing direct) "John Bundy" wrote in message ... Don't think so, what are you trying to accomplish? Actually i'm not even sure of the question, are you just wanting to change the name of the userform? or set the name to a variable? "Gary Keramidas" wrote: anyway to set a userform name to a variable i can use with <variable name instead of with userform1, with userform2, etc? -- Gary |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Bob,
What is UserForms? I can't find it in the documentation. From your code fragment it looks like a collection - but I created a spreadsheet with 2 userforms and when I type "?UserForms.Count" in the immediate window I get 0 rather than 2. Is there any way to do something like the following code fragment wants to do: UserForms(myForm).Show where myForm is a string variable? I know that you can do this sort of thing for embedded active X controls via the Shapes collection. Just curious - I can't imagine where I would need it in my code. -John Coleman Bob Phillips wrote: Is this the sort of thing you had in mind Dim oUserForm As Object On Error GoTo err Set oUserForm = UserForms.Add("Userform1") '... With oUserform .Show -- --- HTH Bob (change the xxxx to gmail if mailing direct) "John Bundy" wrote in message ... Don't think so, what are you trying to accomplish? Actually i'm not even sure of the question, are you just wanting to change the name of the userform? or set the name to a variable? "Gary Keramidas" wrote: anyway to set a userform name to a variable i can use with <variable name instead of with userform1, with userform2, etc? -- Gary |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
bob:
i was looking to use a variable to create the userform name. so instead of with userform1, with userform2, i could use: with userform(i) .. .. end with or uform = userform1 then use the variable to manipulate the form ( i know this won't work, but) with uform .. .. end with i've used me.controls("textbox" & i) and am wondering if there is a way to do this with the form itself. Gary "Bob Phillips" wrote in message ... Is this the sort of thing you had in mind Dim oUserForm As Object On Error GoTo err Set oUserForm = UserForms.Add("Userform1") '... With oUserform .Show -- --- HTH Bob (change the xxxx to gmail if mailing direct) "John Bundy" wrote in message ... Don't think so, what are you trying to accomplish? Actually i'm not even sure of the question, are you just wanting to change the name of the userform? or set the name to a variable? "Gary Keramidas" wrote: anyway to set a userform name to a variable i can use with <variable name instead of with userform1, with userform2, etc? -- Gary |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
gary - i'd be interested in the answer to this, too, because when i
change the name of a userform to something like frmGenerate, i can't get the initialization to run.......... but i didn't think of declaring it as a variable in my global declarations module......... susan Gary Keramidas wrote: anyway to set a userform name to a variable i can use with <variable name instead of with userform1, with userform2, etc? -- Gary |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you have
Private Sub frmGenerate_Initialize() then that is the problem. No matter the userform name, it should always be Private Sub Userform_Initialize() -- Regards, Tom Ogilvy "Susan" wrote in message ps.com... gary - i'd be interested in the answer to this, too, because when i change the name of a userform to something like frmGenerate, i can't get the initialization to run.......... but i didn't think of declaring it as a variable in my global declarations module......... susan Gary Keramidas wrote: anyway to set a userform name to a variable i can use with <variable name instead of with userform1, with userform2, etc? -- Gary |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
tom - yes, that's what i have to do. but if you have a macro where
you're calling various userforms from the main macro, it would be nice to be able to differentiate them more easily, even tho i know the initialize sub is directly connected to that specific userform...... when i've got five different userform windows open it gets a little confusing LOL susan Tom Ogilvy wrote: If you have Private Sub frmGenerate_Initialize() then that is the problem. No matter the userform name, it should always be Private Sub Userform_Initialize() -- Regards, Tom Ogilvy "Susan" wrote in message ps.com... gary - i'd be interested in the answer to this, too, because when i change the name of a userform to something like frmGenerate, i can't get the initialization to run.......... but i didn't think of declaring it as a variable in my global declarations module......... susan Gary Keramidas wrote: anyway to set a userform name to a variable i can use with <variable name instead of with userform1, with userform2, etc? -- Gary |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
then you seem to be asking the same question as Gary, so the answer is the
same -- --- HTH Bob (change the xxxx to gmail if mailing direct) "Susan" wrote in message ups.com... tom - yes, that's what i have to do. but if you have a macro where you're calling various userforms from the main macro, it would be nice to be able to differentiate them more easily, even tho i know the initialize sub is directly connected to that specific userform...... when i've got five different userform windows open it gets a little confusing LOL susan Tom Ogilvy wrote: If you have Private Sub frmGenerate_Initialize() then that is the problem. No matter the userform name, it should always be Private Sub Userform_Initialize() -- Regards, Tom Ogilvy "Susan" wrote in message ps.com... gary - i'd be interested in the answer to this, too, because when i change the name of a userform to something like frmGenerate, i can't get the initialization to run.......... but i didn't think of declaring it as a variable in my global declarations module......... susan Gary Keramidas wrote: anyway to set a userform name to a variable i can use with <variable name instead of with userform1, with userform2, etc? -- Gary |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Userform and variable | Excel Discussion (Misc queries) | |||
preserving variable from userform | Excel Programming | |||
VBA Variable as userform | Excel Programming | |||
Variable ComboBox on Userform | Excel Programming | |||
Passing a value to a variable from Userform | Excel Programming |