Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing variables between Sub and Userform
Hi All, I have a sub that assigns a true value to a Boolean Variable. That sub fires a Userform that needs that boolean value to see if a condition was met in the sub and then assign certain value to other variable. I tryed to declare it (Public SwdeLista as Boolean) in Thisworkbook to make it global (even that i read this is not adviceable, i couldn't figure another way!), but doesn't work. The SwdeLista boolean variable keeps "empty". Could you direct me on how to pass a variable (boolean) from a sub to a Userform? Thanks in advance Jose Luis -- jose luis ------------------------------------------------------------------------ jose luis's Profile: http://www.excelforum.com/member.php...o&userid=13312 View this thread: http://www.excelforum.com/showthread...hreadid=387892 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing variables between Sub and Userform
since the sub seems to be the caller of the form, the proper way may be
to make a special sub : this one will receive the boolean value and decide the values of the form, and then shows the form. An other way could be to mask (visible false) a check box but this box could keep a boolean value from an other code. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing variables between Sub and Userform
If you put that public variable in a general module, does it work ok?
jose luis wrote: Hi All, I have a sub that assigns a true value to a Boolean Variable. That sub fires a Userform that needs that boolean value to see if a condition was met in the sub and then assign certain value to other variable. I tryed to declare it (Public SwdeLista as Boolean) in Thisworkbook to make it global (even that i read this is not adviceable, i couldn't figure another way!), but doesn't work. The SwdeLista boolean variable keeps "empty". Could you direct me on how to pass a variable (boolean) from a sub to a Userform? Thanks in advance Jose Luis -- jose luis ------------------------------------------------------------------------ jose luis's Profile: http://www.excelforum.com/member.php...o&userid=13312 View this thread: http://www.excelforum.com/showthread...hreadid=387892 -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing variables between Sub and Userform
Thank you Both, I'll try that Dave, But that's going to be tomorow cause I'm tired and sleepy. Thanks again for your help. See you around Jose Luis Dave Peterson Wrote: If you put that public variable in a general module, does it work ok? jose luis wrote: Hi All, I have a sub that assigns a true value to a Boolean Variable. That sub fires a Userform that needs that boolean value to see if a condition was met in the sub and then assign certain value to other variable. I tryed to declare it (Public SwdeLista as Boolean) in Thisworkbook to make it global (even that i read this is not adviceable, i couldn't figure another way!), but doesn't work. The SwdeLista boolean variable keeps "empty". Could you direct me on how to pass a variable (boolean) from a sub to a Userform? Thanks in advance Jose Luis -- jose luis ------------------------------------------------------------------------ jose luis's Profile: http://www.excelforum.com/member.php...o&userid=13312 View this thread: http://www.excelforum.com/showthread...hreadid=387892 -- Dave Peterson -- jose luis ------------------------------------------------------------------------ jose luis's Profile: http://www.excelforum.com/member.php...o&userid=13312 View this thread: http://www.excelforum.com/showthread...hreadid=387892 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing variables between Sub and Userform
in the userform code, have this:
Option Explicit Public SwdeLista As Boolean in a code module have this: Option Explicit Sub ShowMyForm() ' load the form into memory Load UserForm1 'adjust any values UserForm1.SwdeLista = True 'show the form UserForm1.Show End Sub "jose luis" wrote: Hi All, I have a sub that assigns a true value to a Boolean Variable. That sub fires a Userform that needs that boolean value to see if a condition was met in the sub and then assign certain value to other variable. I tryed to declare it (Public SwdeLista as Boolean) in Thisworkbook to make it global (even that i read this is not adviceable, i couldn't figure another way!), but doesn't work. The SwdeLista boolean variable keeps "empty". Could you direct me on how to pass a variable (boolean) from a sub to a Userform? Thanks in advance Jose Luis -- jose luis ------------------------------------------------------------------------ jose luis's Profile: http://www.excelforum.com/member.php...o&userid=13312 View this thread: http://www.excelforum.com/showthread...hreadid=387892 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing variables between Sub and Userform
In the UserForm1 forms module have this:
Public Sub Myshow (strVal1 as string, bVal2 as boolean) ' do your stuff Me.show End sub In a global module somewhere UserForm1.MyShow string1,bool2 DM Unseen PS this can me amended with Property Get/Let/Set procedures and whatnot |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing variables between Sub and Userform
Thank you both, for your advice. Now I ll code it. Read you around Thanks again Jose Luis DM Unseen Wrote: In the UserForm1 forms module have this: Public Sub Myshow (strVal1 as string, bVal2 as boolean) ' do your stuff Me.show End sub In a global module somewhere UserForm1.MyShow string1,bool2 DM Unseen PS this can me amended with Property Get/Let/Set procedures and whatnot -- jose luis ------------------------------------------------------------------------ jose luis's Profile: http://www.excelforum.com/member.php...o&userid=13312 View this thread: http://www.excelforum.com/showthread...hreadid=387892 |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing variables between Sub and Userform
Thank you both, for your advice. Now I ll code it. Read you around Thanks again Jose Luis DM Unseen Wrote: In the UserForm1 forms module have this: Public Sub Myshow (strVal1 as string, bVal2 as boolean) ' do your stuff Me.show End sub In a global module somewhere UserForm1.MyShow string1,bool2 DM Unseen PS this can me amended with Property Get/Let/Set procedures and whatnot -- jose luis ------------------------------------------------------------------------ jose luis's Profile: http://www.excelforum.com/member.php...o&userid=13312 View this thread: http://www.excelforum.com/showthread...hreadid=387892 |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing variables between Sub and Userform
Thank you both, for your advice. Now I ll code it. Read you around Thanks again Jose Luis DM Unseen Wrote: In the UserForm1 forms module have this: Public Sub Myshow (strVal1 as string, bVal2 as boolean) ' do your stuff Me.show End sub In a global module somewhere UserForm1.MyShow string1,bool2 DM Unseen PS this can me amended with Property Get/Let/Set procedures and whatnot -- jose luis ------------------------------------------------------------------------ jose luis's Profile: http://www.excelforum.com/member.php...o&userid=13312 View this thread: http://www.excelforum.com/showthread...hreadid=387892 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Passing Variables | Excel Discussion (Misc queries) | |||
Passing Variables | Excel Programming | |||
passing variables | Excel Programming | |||
Passing Variables | Excel Programming | |||
Passing variables from module to userform | Excel Programming |