B
Bugs
Great Forums for everthing Office but sometimes there is a lot of reading
required when you want to do something that seems simple and to no avail!
Here is the issue:
Our firm uses templates to create Functional Analsys Documents. The first
two pages of the FA Doc have on them two types of form fields. (Hopefully I
got all the terminology correct as I am a newbie to this type of
programming.)
Ones that can be edited by the user and ones that can get updated by
refrence when pressing the <F9> function key from within the field.
I wanted to simplify this by creating an optional user form that can be
called up through a Custom Menu. I have manage to do so but I'm running in to
updating the text fields in the user form correctly. The first time I use the
user form the defaulted values from the form fields get displayed in the user
form correctly. I used the following code when initailizing the user form;
Private Sub UserForm_Initialize()
With UserForm1
.TextBox2.Text = ActiveDocument.FormFields("Text2").Result
.TextBox1.Text = ActiveDocument.FormFields("Text1").Result
.TextBox3.Text = ActiveDocument.FormFields("Text6").Result
.TextBox4.Text = ActiveDocument.FormFields("Text4").Result
.TextBox5.Text = ActiveDocument.FormFields("Text3").Result
.TextBox6.Text = ActiveDocument.FormFields("Text5").Result
End With
End Sub
Which I obtained through reading in this forum.
I attached the follwoing code to a command button that update the form
fields without killing them ( I had some trouble keeping the form fields in
tact until once again you forum came to the rescue);
Private Sub CommandButton1_Click()
With ActiveDocument
.FormFields("Text2").Result = TextBox2
.FormFields("Text1").Result = TextBox1
.FormFields("Text6").Result = TextBox3
.FormFields("Text4").Result = TextBox4
.FormFields("Text3").Result = TextBox5
.FormFields("Text5").Result = TextBox6
End With
UserForm1.Hide
End Sub
All runs A-Ok until I change the value on the actual FA Document by clicking
on the form field then calling up the user form through the custom menu.
The values in the user form recall the previous values that I entered the
last time I used the user form. It's as if the user form has a buffer that
doesn't get reloaded after the first time the user form is called up.
How can I have the user form reflect the changes of the FA Doc fields No
mater how menay time the user form is called up?
I want to be able to edit these field from either the FA Doc form fields or
the new user form but alway displaying the correct values!
I have done quite a bit of reading that my eyes a bugging out and can't
hurdle this one yet!
HeLp!
required when you want to do something that seems simple and to no avail!
Here is the issue:
Our firm uses templates to create Functional Analsys Documents. The first
two pages of the FA Doc have on them two types of form fields. (Hopefully I
got all the terminology correct as I am a newbie to this type of
programming.)
Ones that can be edited by the user and ones that can get updated by
refrence when pressing the <F9> function key from within the field.
I wanted to simplify this by creating an optional user form that can be
called up through a Custom Menu. I have manage to do so but I'm running in to
updating the text fields in the user form correctly. The first time I use the
user form the defaulted values from the form fields get displayed in the user
form correctly. I used the following code when initailizing the user form;
Private Sub UserForm_Initialize()
With UserForm1
.TextBox2.Text = ActiveDocument.FormFields("Text2").Result
.TextBox1.Text = ActiveDocument.FormFields("Text1").Result
.TextBox3.Text = ActiveDocument.FormFields("Text6").Result
.TextBox4.Text = ActiveDocument.FormFields("Text4").Result
.TextBox5.Text = ActiveDocument.FormFields("Text3").Result
.TextBox6.Text = ActiveDocument.FormFields("Text5").Result
End With
End Sub
Which I obtained through reading in this forum.
I attached the follwoing code to a command button that update the form
fields without killing them ( I had some trouble keeping the form fields in
tact until once again you forum came to the rescue);
Private Sub CommandButton1_Click()
With ActiveDocument
.FormFields("Text2").Result = TextBox2
.FormFields("Text1").Result = TextBox1
.FormFields("Text6").Result = TextBox3
.FormFields("Text4").Result = TextBox4
.FormFields("Text3").Result = TextBox5
.FormFields("Text5").Result = TextBox6
End With
UserForm1.Hide
End Sub
All runs A-Ok until I change the value on the actual FA Document by clicking
on the form field then calling up the user form through the custom menu.
The values in the user form recall the previous values that I entered the
last time I used the user form. It's as if the user form has a buffer that
doesn't get reloaded after the first time the user form is called up.
How can I have the user form reflect the changes of the FA Doc fields No
mater how menay time the user form is called up?
I want to be able to edit these field from either the FA Doc form fields or
the new user form but alway displaying the correct values!
I have done quite a bit of reading that my eyes a bugging out and can't
hurdle this one yet!
HeLp!