I am having issues copying text from a textbox in a userform to an embeded word object in my worksheet.
So far I can copy the data to the clipboard but cannot find a way to get the data from the clipboard to the word object. I can select the word object so it's active but nothing happens with the sendkeys. Before the copy procedure I would like to select any existing text so it gets overwritten.
Does anyone know a nother way to do this?
Code I have so far is:
Private Sub CommandButton1_Click()
Dim objData As DataObject
Dim strClipBoard As String
Set objData = New DataObject
' Clears the clipboard
objData.SetText ""
objData.PutInClipboard
' Puts the text from an textBox into the clipboard
strClipBoard = UserFormNY.txtbox1.Value
objData.SetText strClipBoard
objData.PutInClipboard
ActiveSheet.Shapes("Object 19").Select
Selection.Verb Verb:=xlPrimary
SendKeys "^A"
SendKeys "^V"
Unload Me
End Sub
Thanks in advance!
So far I can copy the data to the clipboard but cannot find a way to get the data from the clipboard to the word object. I can select the word object so it's active but nothing happens with the sendkeys. Before the copy procedure I would like to select any existing text so it gets overwritten.
Does anyone know a nother way to do this?
Code I have so far is:
Private Sub CommandButton1_Click()
Dim objData As DataObject
Dim strClipBoard As String
Set objData = New DataObject
' Clears the clipboard
objData.SetText ""
objData.PutInClipboard
' Puts the text from an textBox into the clipboard
strClipBoard = UserFormNY.txtbox1.Value
objData.SetText strClipBoard
objData.PutInClipboard
ActiveSheet.Shapes("Object 19").Select
Selection.Verb Verb:=xlPrimary
SendKeys "^A"
SendKeys "^V"
Unload Me
End Sub
Thanks in advance!