Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setfocus + Sendkey problems

Status
Not open for further replies.

hamzajosh

Programmer
Sep 18, 2002
182
0
0
US
I have a form which has a RTF textbox on it. I am using sendkeys to paste some data into the textbox from the clipboard. The setfocus does not set focus to the textbox via code. If i load the form and run the same code thru a button_click, it works great but if i run the same code in userform.activate, it does not run. the code is as follows

Rtf_Box.SetFocus
Rtf_Box.SelStart = 0
Rtf_Box.SelLength = Len(Rtf_Box.Text)
SendKeys "+{insert}", True

Any help would be appreciated, thanks




Learn everything but implement only what is needed.
 
Is this in Word, Excel? Have you tried making sure the INS paste is true?


TextBox1.SetFocus
Options.INSKeyForPaste = True
SendKeys "+{insert}", True

in the userform.activate inserts the clipboard text into the textbox.

Gerry
Painting/Sculpture site:
 
thanks, that worked

Learn everything but implement only what is needed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top