View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
LuisE LuisE is offline
external usenet poster
 
Posts: 133
Default GetFromClipboard help needed please

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