|
-
Aug 27th, 2000, 12:03 AM
#1
Thread Starter
Frenzied Member
I have a form with a text box and a command button.
What would the code look like in order to have the contents of the text box get sent to the clipboard when I click on the command button?
Thanks for your help..
Dan
-
Aug 27th, 2000, 12:08 AM
#2
Code:
Private Sub Command1_Click()
Clipboard.SetText Text1
End Sub
-
Aug 27th, 2000, 12:21 AM
#3
Dennis, your code will copy to the clipboard, but what if the user has not selected anything from the textbox to be copied?
Code:
Private Sub Command1_Click()
Text1.SelStart = 0
Text1.SelLength = Len(Text1)
Clipboard.SetText Text1.SelText
End Sub
-
Aug 27th, 2000, 12:30 AM
#4
Thread Starter
Frenzied Member
Actually, both of your guy's code worked great... However, there is something really strange going on..
When I paste the text that I copied with both of your guy's code into Notepad, it's fine.. But when i paste it into VB or any other program, such as Word, it actually pastes the code. So for example, when I past it into VB or Word, I get:
Text1.SelStart = 0
Text1.SelLength = Len(Text1)
Clipboard.SetText Text1.SelText
Instead of:
<contents of Text1>
Any idea as to why this is happening? Unfortunatley, I'm not using this to be able to paste into Notepad, so it's gonna be a problem..
Thanks again,
Dan
-
Aug 27th, 2000, 01:01 AM
#5
it isnt pasting the code,
for some reason Vb and MS word isnt picking up the text that was copied with the program, it is recognizing the previous clipboard text,
try copying
Dennis is the coolest person in the world
then use the code to copy something in Text1.
when you paste into VB or word you will get
Dennis is the coolest person in the world
I dont know why it happens though.
-
Aug 27th, 2000, 01:11 AM
#6
Thread Starter
Frenzied Member
Problem solved...
Code:
Clipboard.Clear 'clear clipboard of previous copy
Clipboard.SetText Text1
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|