Consulting

Results 1 to 2 of 2

Thread: Looking for Assistance with Userform

  1. #1

    Looking for Assistance with Userform

    Hello everyone,

    I'm sorry if this has been posted before, but I've scoured the internet looking for someone else who's tried to do the same thing. I'm attempting to create a userform in Word that allows the user to track call information. Simply, I want the form to paste the data entered into the word document, then when a new form is submitted, it pastes the new information below the originally input information on the document.

    I'm aware this might be easier to do in excel, however, the limitations of my environment prevent excel from being the best solution. The data from this form would be translated by the employee or user to an overall tracker in excel using a userform, preventing the copy and paste functions from this document if it were to be in excel. I've placed some screen shots of my intended outcome below and any assistance you can offer would be greatly appreciated.

    The new document is created, user clicks New Call and form shows. (This I've been able to accomplish.)
    Grab1.jpg
    User inputs information and clicks submit to paste to document. (I have been able to accomplish this with bookmarks, although I'm not sure if this is the best solution.)
    Grab2.PNG
    Pasted information shows on document. User selects New Call for next call.
    Grab3.jpg
    User inputs new call information into blank form.
    Grab4.PNG
    New call information submitted pastes below the original information with a horizontal rule separating the two calls.
    Grab5.jpg

  2. #2
    You don't need Bookmarks. Assuming the controls on the userform have the default names (otherwise change them in the code) then

    Private Sub CommandButton1_Click()    ActiveDocument.Range.InsertAfter "Name: " & TextBox1.Text & vbCr
        ActiveDocument.Range.InsertAfter "Location: " & TextBox2.Text & vbCr
        If OptionButton1.Value = True Then
            ActiveDocument.Range.InsertAfter "Call Type: A"
        End If
        If OptionButton2.Value = True Then
            ActiveDocument.Range.InsertAfter "Call Type: B"
        End If
        If OptionButton3.Value = True Then
            ActiveDocument.Range.InsertAfter "Call Type: C"
        End If
        ActiveDocument.Range.InsertAfter Chr(11) & "_______________________________________________________________" & vbCr & vbCr
        Unload Me
    End Sub
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

Posting Permissions

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