GetFromClipboard help needed please

L

LuisE

I want to copy the content of a TextBox and paste it to Notepad.
I have the first piece working, I'm opening Notepad but I can't paste it. I
don't want to use SendKeys (Ctrl+V).

This is what I have


Private Sub CommandButton4_Click()

Dim MsgToNotepad
Dim DataObj As New MSForms.DataObject
Dim WshShell

Me.TxtMessage.SelStart = 0
Me.TxtMessage.SelLength = Me.TxtMessage.TextLength
Set MsgToNotepad = Me.TxtMessage 'selects multiline textbox contents
MsgToNotepad.Copy 'copies it to Clipboard

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "Notepad" 'runs Notepad

Dim IntoNotepad As String 'gets it from clipboard and pasts it into Notepad
MsgToNotepad.GetFromClipboard
IntoNotepad = MsgToNotepad.GetText

End Sub



THANKS IS ADVANCE
 

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