Cmd Btn How To:

  • Thread starter Thread starter RK
  • Start date Start date
R

RK

How can I program a command button to input a character
where ever the cursor is? Say the "$" dollar sign.

Thanks RK
 
You can't. When the user clicks the button, the focus moves to the button,
and so the insertion point is lost.

You can use a toolbar button to insert the character into
Screen.ActiveControl, and use SelStart and SelLength to work out where the
insertion point is and what is currently selected.
 
I can't use sendkey someway to do this?

Here is what I am try to do.

I could use MS OSK.exe, but I don't need the whole
keyboard. All I need is just the 10 key.
Any suggestions would be appreciated.

Thanks for the quick response.

RK
 
Try:

Private Sub Command15_Click()
Screen.PreviousControl = Screen.PreviousControl & "$"
End Sub
 
Van, that's fine if he wants the character at the end.

What bothers me is that people who ask this q. usually expect the character
to insert whereever the cursor is in the field, and that's not going to
happen with a command button.
 
This will work fine. I will check it out.

It would be nice to place it where the cursor is, but if
it is at the end, it is at least a start.

Thanks Reed
 
I thought that I could use this, but I can't. There has
to be a way to input the character where the cursor is.
Is there another way?

Thank you for reading this
RK
 
Back
Top