Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to tell what textbox got the focus
Hi I have a form with two textboxes and a button that I want to use to paste
into the textboxes for another source, I have tried to use gotfocus with the textbox but I can't get it to work can someone please show how I can do this thanks. TIA Charles |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to tell what textbox got the focus
vqthomf:
try ? r = Len(TextBox1.Text) TextBox1.SetFocus TextBox1.SelStart = 0 TextBox1.SelLength = r TextBox1.Paste -- 天行健,君*以自強不息 地勢坤,君*以厚德載物 http://www.vba.com.tw/plog/ "vqthomf" wrote: Hi I have a form with two textboxes and a button that I want to use to paste into the textboxes for another source, I have tried to use gotfocus with the textbox but I can't get it to work can someone please show how I can do this thanks. TIA Charles |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to tell what textbox got the focus
Try this:
Private Sub CommandButton1_Click() MsgBox Me.ActiveControl.Name End Sub so ActiveControl returns a reference to the selected control (textbox). However, you must change the TakeFocusOnClick property of the commandbutton to False otherwise ActionControl will refer to the commandbutton itself. -- Regards, Tom Ogilvy "vqthomf" wrote in message ... Hi I have a form with two textboxes and a button that I want to use to paste into the textboxes for another source, I have tried to use gotfocus with the textbox but I can't get it to work can someone please show how I can do this thanks. TIA Charles |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
TextBox focus 4 | Excel Programming | |||
TextBox focus 3 | Excel Programming | |||
TextBox focus | Excel Programming | |||
TextBox Focus | Excel Programming | |||
Which textbox have focus? | Excel Programming |