Copy text to Embeded Word object

cerbsurf

New Member
Joined
Jan 12, 2009
Messages
8
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!
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Code:
Private Sub CommandButton1_Click()

    ActiveSheet.Shapes("Object 19").DrawingObject.Object.Content.Text = UserFormNY.txtbox1.Value
    
    Unload Me
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,591
Messages
6,179,768
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top