Cmd Btn How To:

R

RK

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

Thanks RK
 
A

Allen Browne

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.
 
R

RK

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
 
V

Van T. Dinh

Try:

Private Sub Command15_Click()
Screen.PreviousControl = Screen.PreviousControl & "$"
End Sub
 
A

Allen Browne

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.
 
V

Van T. Dinh

Thanks, Allen.

Somehow, I was thinking the O.P. wants the char at the end ...
 
R

RK

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
 
R

RK

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
 

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