Cut

  • Thread starter Thread starter Jone
  • Start date Start date
J

Jone

What code do I write to cut from a text box in a form?

And what code do I write when I want to get the os version or name
 
Jone said:
No I Don't want to delete it I want to cut it so could paste it somewere
else


"Cut" is by definition a delete and a copy. Do you want to cut or just
copy? Do you really intend to put this value on the clipboard, or do you
just want to get the value and save it somewhere handy for processing by
later code.

To copy a text box's value to the clipboard, you can do this:

With Me!YourTextbox
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
RunCommand acCmdCopy
End With

If you really want to cut it -- that is, copy to clipboard and delete --
then use acCmdCut instead of acCmdCopy.
 
Jone said:
What code do I write to cut from a text box in a form?

With Me.Textbox
.SetFocus
.SelStart = 1
.SelLength = 255
End With
DoCmd.RunCommand acCmdCut
And what code do I write when I want to get the os version or name

Debug.Print Environ("OS")
 
Jone said:
Ok thanks!, now, how do I past the value in an other textbox ?


If you're not planning to do it manually, I wonder if you need to involve
the clipboard at all. What is it you really want to do? Copying or moving
a value from one text box to another in code can be accomplished much more
simply than by copy/pasting.
 
Back
Top