hehee how bout like this..?
Code:Private Function GetNewResult(wField As Word.Field, WordDoc As Word.Document) As String Dim StopPos As Long Dim Variable As String Dim UsedVariable As String Dim VariableValue As String Dim wRange As Word.Range Debug.Print wField.Code ' These three lines strip down the field code to find ' out it's name StopPos = InStrRev(wField.Code, "\*") Variable = Left(wField.Code, StopPos - 3) Variable = Right(Variable, Len(Variable) - 14) ' Check this field hasn't already appeared in this ' document. If CheckUsedVariable(Variable) Then VariableValue = GetVariableValue(Variable) Else ' Get the value of the field from the user 'VariableValue = InputBox("Enter value for: " & Variable) If Variable = "Name" Then VariableValue = Text1.Text ElseIf Variable = "Age" Then VariableValue = Text2.Text End If AddNewVariable Variable, VariableValue End If ' I WANT TO REPLACE THE ABOVE LINE OF CODE WITH: ' VariableValue = Text1.text ' FOR NAME 'VariableValue = Text2.text ' FOR AGE 'BUT IN THE MS WORD IT PUTS THE VALUE OF TEXT2.TEXT ON BOTH DOVARIABLES i.e Name and Age. GetNewResult = VariableValue End Function




"More Heads are Better than One"
Reply With Quote