Consulting

Results 1 to 6 of 6

Thread: Solved: User Form Help

  1. #1
    VBAX Newbie
    Joined
    Feb 2005
    Posts
    2
    Location

    Solved: User Form Help

    I am quite new to VBA and need some help with a user form I have created.

    I have a few fields on the user form which I want the user to fill in. once this has been completed I would then like this info to be transferred to certain fields in a word document. I have already marked out the fields using bookmarks but I am have trouble transferring the text to the fields

  2. #2
    VBAX Mentor
    Joined
    Sep 2004
    Location
    Nashua, NH, USA
    Posts
    489
    Location
    That's a very general question.

    One place to start may be with Steve Roman's Writing Word Macros book.
    Alse, see http://www.standards.com/index.html?WordVBABooks.

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Bryan,
    Have a look at this KB item which contains a few demonstration samples.
    http://www.vbaexpress.com/kb/getarticle.php?kb_id=184
    If you need more assistance, let us know.
    MD

  4. #4
    VBAX Regular TButhe's Avatar
    Joined
    Sep 2004
    Location
    Sioux Falls, SD
    Posts
    64
    Location
    Just had this same question and found it in a thread here but can't remember which one. Anyway you will need a command button on your user form and then you will need to place bookmarks in your document where you want the text to be and name them something unique like Date, or ContactName. You will also need to know the name of your text box on your user form. Once that is done you will need to add the code to the button you placed on the user form. Here is some sample code.

    [VBA]
    Private Sub cmdOK_Click()
    'my command button is named "cmdOK" without the quotes
    Selection.GoTo What:=wdGoToBookmark, Name:="Date"
    'where "Date" is put the name of your Bookmark but this time use the quotes
    Selection.Range.Text = Me.tbDate.Text
    'Where tbDate is - use the name of the text box that you are
    'capturing the data in on your user form mine happens to be "tbDate"

    End Sub
    [/VBA]

    Hope this helps! I have to run so please forgive me if I forgot anything!!
    Thanks,
    Tracy

  5. #5
    VBAX Regular
    Joined
    Nov 2004
    Posts
    74
    Location
    Hiya Bryan,

    If your still struggling post an example and I'd be glad to help, I learnt from the master DRJ.

    TButhe is spot on however I find basic names helpful so here you are.

    [VBA]
    Private Sub CommandButton1_Click()
    Selection.GoTo What:=wdGoToBookmark, Name:="Bookmark1"
    Selection.Range.Text = Me.TextBox1.Text
    Unload Me
    End Sub
    [/VBA]

  6. #6
    VBAX Newbie
    Joined
    Feb 2005
    Posts
    2
    Location
    thanks for your help everyone. sorry i have not replied I have had a few PC problems!. I have managed to work this out with all your help, really appreciate it!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •