I need to insert text at the curson position in a text box on a VBA form. I know how to make the button not take the focus; I just need to know how to pass the cursor a timestamp.
Insert Date & Time At Mouse Insertion In TextBox
-
-
-
Re: Insert Text At Cursor On Vba Form
Do you mean at the end of what ever is cuurently in the textbox or at the position of the cursor within the textbox?
-
Re: Insert Text At Cursor On Vba Form
I want to insert the time stamp it at whatever is the current cursor position.
-
Re: Insert Text At Cursor On Vba Form
To clarify, you will have a textbox with some text in it like "This is some text." and at some point the cursor could be between the o and the m in the word "some" and a timed macro will fire at which point you want the text in the textbox to read something like "This is so09/27/2007 2:48pmme text."?
-
Re: Insert Text At Cursor On Vba Form
I figured it out. See below.
Code
Display MorePrivate Sub timeStamper_Click() cBoard Format(timeStamp, "m-dd h:mm:ss am/pm") Application.SendKeys ("^v") End Sub Function cBoard(myText) Set mydata = New DataObject mydata.SetText myText mydata.PutInClipboard End Function
[hr]*[/hr] Auto Merged Post;[dl]*[/dl]Oh yeah. This too.
-
-
Re: Insert Text At Cursor On Vba Form
Cool. Thanks for sharing your solution!
-
-
Re: Insert Text At Cursor On Vba Form
QuotePeople don't cotton to using SendKeys for reliability reasons
Good sound advice for ANYONE.
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!