Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 233
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing Variables Jeff Excel Discussion (Misc queries) 1 November 4th 05 06:46 PM
Passing Variables Paula[_3_] Excel Programming 1 August 23rd 04 06:55 PM
passing variables Squid[_2_] Excel Programming 1 July 27th 04 03:47 AM
Passing Variables Tom Ogilvy Excel Programming 0 July 23rd 04 04:19 PM
Passing variables from module to userform Chris Dunigan Excel Programming 4 November 26th 03 09:37 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"