Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Return a string based on which Textbox is clicked

Hi there,

I have a form with text boxes on different pages.

When a user clicks some of these boxes another form pops up displaying
a calendar which is used to fill the aforementioned textbox.

This is all fine and good but I need to pass a variable on to the
calendar form to tell it which textbox to fill in.


So basically I'm having trouble finding a way to capture which textbox
was clicked on one form and passing that information on to the other
form.

Any help would be appreciated!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default Return a string based on which Textbox is clicked

Hi Andy,

I dit not compleetly build your situation.
I created 1 module with:

Public clickedBox As Control

I created 2 forms
On form 1 two textboxes.
For the textboxes I filled the Tag property with something.
And with the code:

Private Sub TextBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Set clickedBox = Me.TextBox1
UserForm2.Show
End Sub

Private Sub TextBox2_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Set clickedBox = Me.TextBox2
UserForm2.Show
End Sub

On Form2 1 Label, 1 Textbox and 2 buttions ( OK and cancel)
And with the code:


Private Sub Cancel_Click()
Me.Hide
End Sub

Private Sub cmdOK_Click()
clickedBox.Text = Me.TextBox1.Text
Me.Hide
End Sub

Private Sub UserForm_Activate()
Me.Label1.Caption = clickedBox.Tag
Me.TextBox1.Text = clickedBox.Text
End Sub


HTH,

Wouter
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Return a string based on which Textbox is clicked

Wouter,

With your clear examples I could modify my code to work as needed, so
thank you very much!

Andy
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
Textbox values won't change untill clicked on!!!!!!!!!! Tdp Excel Discussion (Misc queries) 2 November 12th 08 02:04 PM
Textbox values won't change untill clicked on!!!!!!!!!!! Tdp Excel Discussion (Misc queries) 2 November 11th 08 10:02 AM
Userform - Return Control Clicked MDubbelboer[_20_] Excel Programming 5 August 12th 08 08:46 PM
Find a string in a range and return two values based on offsets Aaron Dyck Excel Programming 1 October 13th 06 03:41 AM
Return Index of Control Object Clicked! gr8guy Excel Programming 3 May 11th 04 05:24 AM


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