Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Passing Form Values

I've a form that allows the user to enter a filename.

I want the filename entered to be used in another function, the
function that calls the form in the first place, but the variable
appears to be volatile, ie it's not being passed back to the calling
function.

How do I get the variable passed back? I could do it by writing it
onto the worksheet but is there a way of doing it just with variables?

Let me know if you want to see the code.

Thanks!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Passing Form Values

One way is to have a public property in the form and test that afterwards

Dim myForm As UserForm1

If myForm Is Nothing Then Set myForm = New UserForm1
myForm.Show
MsgBox myForm.myProp
Set myForm = Nothing

In the form have a public variable

Public myProp as Boolean

and set it in the form code. Ensure that in the form you hide when exiting,
not unload.


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"David" wrote in message
oups.com...
I've a form that allows the user to enter a filename.

I want the filename entered to be used in another function, the
function that calls the form in the first place, but the variable
appears to be volatile, ie it's not being passed back to the calling
function.

How do I get the variable passed back? I could do it by writing it
onto the worksheet but is there a way of doing it just with variables?

Let me know if you want to see the code.

Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Passing Form Values

Another way is to use a Public variable in a General module (not in the userform
code module).

Public MyFileName as String 'or whatever you want.

Then this variable will be able to be seen by any procedure.

David wrote:

I've a form that allows the user to enter a filename.

I want the filename entered to be used in another function, the
function that calls the form in the first place, but the variable
appears to be volatile, ie it's not being passed back to the calling
function.

How do I get the variable passed back? I could do it by writing it
onto the worksheet but is there a way of doing it just with variables?

Let me know if you want to see the code.

Thanks!


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Passing Form Values

A form property can be seen by any procedure as well.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Dave Peterson" wrote in message
...
Another way is to use a Public variable in a General module (not in the
userform
code module).

Public MyFileName as String 'or whatever you want.

Then this variable will be able to be seen by any procedure.

David wrote:

I've a form that allows the user to enter a filename.

I want the filename entered to be used in another function, the
function that calls the form in the first place, but the variable
appears to be volatile, ie it's not being passed back to the calling
function.

How do I get the variable passed back? I could do it by writing it
onto the worksheet but is there a way of doing it just with variables?

Let me know if you want to see the code.

Thanks!


--

Dave Peterson



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Passing Form Values

But I don't have to worry about hiding or unloading (after I change the
variable).



Bob Phillips wrote:

A form property can be seen by any procedure as well.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Dave Peterson" wrote in message
...
Another way is to use a Public variable in a General module (not in the
userform
code module).

Public MyFileName as String 'or whatever you want.

Then this variable will be able to be seen by any procedure.

David wrote:

I've a form that allows the user to enter a filename.

I want the filename entered to be used in another function, the
function that calls the form in the first place, but the variable
appears to be volatile, ie it's not being passed back to the calling
function.

How do I get the variable passed back? I could do it by writing it
onto the worksheet but is there a way of doing it just with variables?

Let me know if you want to see the code.

Thanks!


--

Dave Peterson


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Passing Form Values

Dave, you don't have to worry anyway. It's only Excel.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Dave Peterson" wrote in message
...
But I don't have to worry about hiding or unloading (after I change the
variable).



Bob Phillips wrote:

A form property can be seen by any procedure as well.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Dave Peterson" wrote in message
...
Another way is to use a Public variable in a General module (not in the
userform
code module).

Public MyFileName as String 'or whatever you want.

Then this variable will be able to be seen by any procedure.

David wrote:

I've a form that allows the user to enter a filename.

I want the filename entered to be used in another function, the
function that calls the form in the first place, but the variable
appears to be volatile, ie it's not being passed back to the calling
function.

How do I get the variable passed back? I could do it by writing it
onto the worksheet but is there a way of doing it just with variables?

Let me know if you want to see the code.

Thanks!

--

Dave Peterson


--

Dave Peterson



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Passing Form Values

I think it was that Excel wunderkind who sang:
It's only Excel, but I like it....

(it almost scans...)

http://www.mp3lyrics.org/r/rolling-s...y-rock-n-roll/


Bob Phillips wrote:

Dave, you don't have to worry anyway. It's only Excel.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Dave Peterson" wrote in message
...
But I don't have to worry about hiding or unloading (after I change the
variable).



Bob Phillips wrote:

A form property can be seen by any procedure as well.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Dave Peterson" wrote in message
...
Another way is to use a Public variable in a General module (not in the
userform
code module).

Public MyFileName as String 'or whatever you want.

Then this variable will be able to be seen by any procedure.

David wrote:

I've a form that allows the user to enter a filename.

I want the filename entered to be used in another function, the
function that calls the form in the first place, but the variable
appears to be volatile, ie it's not being passed back to the calling
function.

How do I get the variable passed back? I could do it by writing it
onto the worksheet but is there a way of doing it just with variables?

Let me know if you want to see the code.

Thanks!

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
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 variable to and from a form Dan Excel Programming 1 July 3rd 07 10:53 AM
Passing Controls on a form between modules Graham Y[_2_] Excel Programming 1 November 6th 06 12:50 PM
User Form value passing problem [email protected] Excel Programming 2 August 9th 06 05:19 PM
passing control value from one form to another form mark kubicki Excel Programming 1 April 3rd 04 01:27 AM
Passing data back from a form Tom Ogilvy Excel Programming 0 November 24th 03 04:27 PM


All times are GMT +1. The time now is 03:16 PM.

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"