How to INSERT (not replace) some text into a TEXT control

G

Guest

I want the user to position the caret inside the control (somewhere among
existing characters in that control) and then click a button to insert the
contents of a variable containing text. Of course as soon as he clicks the
button the code will not know where to insert.
 
G

Guest

You can declare a module level variable, say
Private myTextSelStart As Integer
And set it when leaving the TextBox

Private Sub Text0_Exit(Cancel As Integer)
myTextSelStart = Text0.SelStart
End Sub

Then you can use this variable inside the Button click

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top