Slightly lost on how to name things. Currently my form has "var1" as the recipient's name
Quote:
Private Sub CommandButton1_Click()
'Define the variable oVars
Set oVars = ActiveDocument.Variables
'Hide the userform
Me.Hide
'Assign the values of the seven text boxes to the seven variables
oVars("var1").Value = Me.TextBox1.Value
oVars("var2").Value = Me.TextBox2.Value
oVars("var3").Value = Me.TextBox3.Value
oVars("var4").Value = Me.TextBox4.Value
oVars("var5").Value = Me.TextBox5.Value
oVars("var6").Value = Me.TextBox6.Value
oVars("var7").Value = Me.TextBox7.Value
'Update the fields in the body of the document
'Fields in other parts of the document will probably require extra code
'See http://www.gmayor.com/installing_macro.htm
ActiveDocument.Fields.Update
'Clear the variable
Set oVars = Nothing
'Unload the form
Unload Me
End Sub
|
EDIT: Sorry, hadn't reviewed the link you put in yet. I looked at the instructions for FillBM, just trying to figure out how to name it for the right value.
From what you have:
Quote:
Public Sub FillBM(strBMName As String, strValue As String)
'Graham Mayor
Dim oRng As Range
With ActiveDocument
On Error GoTo lbl_Exit
Set oRng = .Bookmarks(strBMName).Range
oRng.Text = strValue
oRng.Bookmarks.Add strBMName
End With
lbl_Exit:
Set oRng = Nothing
Exit Sub
End Sub
|
What part do I change to reflect the value from my textbox?