enigmaes
07-26-2014, 09:35 PM
Hi, all.
Using Word 2013. Trying to get a userform to fill in DocVariable formfields. Not having any luck. :)
Following programming is in place:
On the Userform:
Option Explicit
Private Sub cmdOK_Click()
Dim oVars As Variables
Set oVars = ActiveDocument.Variables
Me.Hide
With ActiveDocument
oVars("First") = Me.TextBox1.Text
oVars("Last") = Me.TextBox2.Text
oVars("DOB") = Me.TextBox3.Text
oVars("ID") = Me.TextBox4.Text
End With
ActiveDocument.Fields.Update
Set oVars = Nothing
Unload Me
End Sub
Private Sub TextBox1()
End Sub
Private Sub TextBox2()
End Sub
Private Sub TextBox3()
End Sub
Private Sub TextBox4()
End Sub
On the Document Module 1:
Option Explicit
Sub AutoNew()
Call ShowMyForm
End Sub
Sub ShowMyForm()
MyFormm.Show
End Sub
Sub CallUF()
Dim oFrm As MyFormm
Set oFrm = New MyFormm
oFrm.Show
Set oFrm = Nothing
lbl_Exit:
Exit Sub
End Sub
Help?
I also would like to have the file open, accept the information, plug it in, and then save it using a concatenated text string with directory\Last-First ID blah.doc, so that any further changes have already been saved to a new document name, generated by input from the userform.
Thanks in advance!
Using Word 2013. Trying to get a userform to fill in DocVariable formfields. Not having any luck. :)
Following programming is in place:
On the Userform:
Option Explicit
Private Sub cmdOK_Click()
Dim oVars As Variables
Set oVars = ActiveDocument.Variables
Me.Hide
With ActiveDocument
oVars("First") = Me.TextBox1.Text
oVars("Last") = Me.TextBox2.Text
oVars("DOB") = Me.TextBox3.Text
oVars("ID") = Me.TextBox4.Text
End With
ActiveDocument.Fields.Update
Set oVars = Nothing
Unload Me
End Sub
Private Sub TextBox1()
End Sub
Private Sub TextBox2()
End Sub
Private Sub TextBox3()
End Sub
Private Sub TextBox4()
End Sub
On the Document Module 1:
Option Explicit
Sub AutoNew()
Call ShowMyForm
End Sub
Sub ShowMyForm()
MyFormm.Show
End Sub
Sub CallUF()
Dim oFrm As MyFormm
Set oFrm = New MyFormm
oFrm.Show
Set oFrm = Nothing
lbl_Exit:
Exit Sub
End Sub
Help?
I also would like to have the file open, accept the information, plug it in, and then save it using a concatenated text string with directory\Last-First ID blah.doc, so that any further changes have already been saved to a new document name, generated by input from the userform.
Thanks in advance!