Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default using Global variable of Userform in module

Hi
I'm a fresher to VBA scripting. I'm trying to assign a value to a global
variable defined in Userform' General Declaration and then using that value
in my module.

tried my way but values are blank when my Userform ends.

any suggestion would be a gr8 help. Calling all life savers..."HELP".
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default using Global variable of Userform in module

I think the easiest thing to do is to move the declaration to a general module.

Public MyVar as WhatEver



Anoop wrote:

Hi
I'm a fresher to VBA scripting. I'm trying to assign a value to a global
variable defined in Userform' General Declaration and then using that value
in my module.

tried my way but values are blank when my Userform ends.

any suggestion would be a gr8 help. Calling all life savers..."HELP".


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default using Global variable of Userform in module

Set it as a property of that form.

In the form add

Public Property Get MyVar As String
myVar = your_variable_name
End Property

and in the module where you show the form, retrieve the property afterwards


With Userform1

.Show
module_variable = .MyVar
End With

--
__________________________________
HTH

Bob

"Anoop" wrote in message
...
Hi
I'm a fresher to VBA scripting. I'm trying to assign a value to a global
variable defined in Userform' General Declaration and then using that
value
in my module.

tried my way but values are blank when my Userform ends.

any suggestion would be a gr8 help. Calling all life savers..."HELP".



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
Set Global Variable Inside Object Module Randy[_2_] Excel Programming 3 October 7th 07 02:21 AM
Pass variable from module to userform and back [email protected] Excel Programming 0 July 20th 06 04:46 PM
Global (Module) Variable Problem Allen Geddes Excel Programming 2 November 21st 05 03:36 PM
userform variable as global crew3407[_6_] Excel Programming 8 May 6th 04 04:38 PM
Global module Al Excel Programming 2 April 30th 04 12:02 PM


All times are GMT +1. The time now is 11:59 PM.

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

About Us

"It's about Microsoft Excel"