Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 139
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
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 focus 4 Tim Coddington Excel Programming 6 August 4th 04 03:51 AM
TextBox focus 3 Tim Coddington Excel Programming 4 July 31st 04 04:35 AM
TextBox focus Tom Ogilvy Excel Programming 0 June 3rd 04 03:17 PM
TextBox Focus John Wilson Excel Programming 6 January 16th 04 09:59 PM
Which textbox have focus? Tom Ogilvy Excel Programming 0 August 27th 03 03:12 PM


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