Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Returning a value from a form

Hello

I would like a form I have built to return a value to the sub that called
it. The built in dialog boxes, like the OK/Cancel one do this. Anyone know
how this can be achieved?

Thanks,
Steve
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 380
Default Returning a value from a form

Create a Public variable in a standard code module, set that in the
userform, read it after exiting the userform.

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Blue Aardvark" wrote in message
...
Hello

I would like a form I have built to return a value to the sub that called
it. The built in dialog boxes, like the OK/Cancel one do this. Anyone know
how this can be achieved?

Thanks,
Steve



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Returning a value from a form

Thanks. Thats nice and simple. But is there no slick way of doing it? Or do
the inbuilt dailogs do exactly the same thing, but just hide the public
variable away.

"Bob Phillips" wrote:

Create a Public variable in a standard code module, set that in the
userform, read it after exiting the userform.

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Blue Aardvark" wrote in message
...
Hello

I would like a form I have built to return a value to the sub that called
it. The built in dialog boxes, like the OK/Cancel one do this. Anyone know
how this can be achieved?

Thanks,
Steve




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 380
Default Returning a value from a form

No, because a Userform is not a method, whereas MsgBox is. A Userform is a
class module, so you can set a Public property within that and read it on
exit with

Userform1.myVar

but for this you cannot unload the userform, you have to hide it (Otherwise
the property is unloaded with it).

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Blue Aardvark" wrote in message
...
Thanks. Thats nice and simple. But is there no slick way of doing it? Or

do
the inbuilt dailogs do exactly the same thing, but just hide the public
variable away.

"Bob Phillips" wrote:

Create a Public variable in a standard code module, set that in the
userform, read it after exiting the userform.

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Blue Aardvark" wrote in

message
...
Hello

I would like a form I have built to return a value to the sub that

called
it. The built in dialog boxes, like the OK/Cancel one do this. Anyone

know
how this can be achieved?

Thanks,
Steve






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
Pass variable from form to form to form headly Excel Programming 1 May 31st 06 02:50 AM
searching excel with a form and returning the results jjfjr Excel Programming 0 May 31st 05 11:54 PM
Returning checked Nodes from Treeview form control Dan Thompson Excel Programming 1 December 14th 04 08:33 AM
returning values from a User Form rohnds[_3_] Excel Programming 2 July 18th 04 04:59 PM
Returning control to form P. Dileepan[_2_] Excel Programming 11 April 11th 04 02:25 AM


All times are GMT +1. The time now is 01:58 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"