Share via

Paste data from textbox UserForms into specific spot in word document

Anonymous
2011-04-13T06:57:01+00:00

I created a UserForm with TextBoxes.  I would like the data that gets entered into the TextBoxes to be pasted from the UserForm into specific locations of the word document when I click a command button on the UserForm.

This is relatively easy when working with Excel since I can reference the exact cell I want the data to be pasted into.  For example

Sub Commandbtn_Click()

With Sheets("Sheet1")

.Range("B11").Value = TextBox1.Text

.Range("C11").Value = TextBox2.Text

.Range("D11").Value = TextBox3.Text

End With

Unload Me

End Sub

However, how would I do this with a word document? How do I get the data to paste from the TextBox into the exact spot in the word document where I want it to go?

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

HansV 462.6K Reputation points
2011-04-13T07:54:20+00:00

You could create bookmarks for those specific locations in the document.

See http://word.mvps.org/FAQs/MacrosVBA/InsertingTextAtBookmark.htm for a method to insert text at a specific bookmark without deleting the bookmark.

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2011-04-13T16:45:10+00:00

    Thank you Kind Sir.  This is very helpful!

    Was this answer helpful?

    0 comments No comments