
Please help with text box to word bookmark
In VBA, you would do this with a userform, and the relevant code would
usually live in the Click event of the button that dismisses the form
(typically the "OK" button). Assuming the textbox control is TextBox1,
the code would be:
Private Sub cmdOK_Click
ActiveDocument.Bookmarks("vbwords").Range.InsertAfter TextBox1.Text
Unload Me
End Sub
This group is about VBA, not VB, so whether the code above translates
seamlessly to VB, I couldn't say. If this gets you nowhere, you may
want to ask this question in a VB group.
-- See the MVP FAQ at http://www.mvps.org/word --------------------------
----------------- "Life is nothing if you're not obsessed." --John Waters
-------------------------------------------------------------------------
Reply to group ONLY. Do not attach files. MVPs do not work for Microsoft.
Quote:
> Hi All
> Sorry only me again!
> I have a biggy one this time that is really baffalling me.
> I want to be able to enter in words, numbers etc.. in my vb programs text
> box, then i want vb to put them to go into a MS word document.
> I know how to setup a textbox in vb, and i know how to setup a msword doc
> with a bookmark,. however i am missing the link
> on how to tell vb to enter in the text to the word.doc bookmark.
> jsut for example, if my doc was c:\word\vbprogram.doc and the bookmark was
> "vbwords" what would the code be ?
> I am sure it can be done, does anyone know how ?
> Many Thanks!
> Mark.