Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Passing Userform Control to Subroutine

I want to pass values from a userform textbox to a subroutine by reference so
that the subroutine can pass back the result into the textbox.

doEqual tbResult1.Value, tbInput1.Value

Private Sub doEqual(resultAmt, inAmt)

This runs OK and debug "watch" values show the correct amount in resultAmt
and InAmt, but tbResult1.Value remains unchanged. Is this a syntax issue,
or???

TIA,

Phil
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Passing Userform Control to Subroutine


Private Sub doEqual(resultAmt, tbx As MSForms.TextBox)
tbx.text = "Amount = " & resultAmt

In the calling procedure pass a referent to the textbox, if that's in the
parent userform -
Call doEqual(123, me.Textbox1)

Regards,
Peter T


"cellist" wrote in message
...
I want to pass values from a userform textbox to a subroutine by reference
so
that the subroutine can pass back the result into the textbox.

doEqual tbResult1.Value, tbInput1.Value

Private Sub doEqual(resultAmt, inAmt)

This runs OK and debug "watch" values show the correct amount in resultAmt
and InAmt, but tbResult1.Value remains unchanged. Is this a syntax issue,
or???

TIA,

Phil



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Passing Userform Control to Subroutine

Peter,

Thanks for your help, that clears it up for me.

Regards,

Phil

"Peter T" wrote:


Private Sub doEqual(resultAmt, tbx As MSForms.TextBox)
tbx.text = "Amount = " & resultAmt

In the calling procedure pass a referent to the textbox, if that's in the
parent userform -
Call doEqual(123, me.Textbox1)

Regards,
Peter T


"cellist" wrote in message
...
I want to pass values from a userform textbox to a subroutine by reference
so
that the subroutine can pass back the result into the textbox.

doEqual tbResult1.Value, tbInput1.Value

Private Sub doEqual(resultAmt, inAmt)

This runs OK and debug "watch" values show the correct amount in resultAmt
and InAmt, but tbResult1.Value remains unchanged. Is this a syntax issue,
or???

TIA,

Phil



.

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 ComboBox to subroutine Anand Excel Programming 7 May 9th 08 11:00 PM
Passing ranges to a subroutine [email protected] Excel Programming 1 March 11th 08 03:15 AM
Passing variable values to userform control KJ-clueless Excel Discussion (Misc queries) 2 November 27th 07 10:51 PM
Passing Module to subroutine SixSigmaGuy[_2_] Excel Programming 2 April 25th 06 10:59 PM
Passing arrays to a subroutine Braden Craig Excel Programming 4 August 17th 03 05:54 PM


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