Userform References

P

Pyrite

I have created a UserForm for a template document. There are four fields
which are completed in this manner. The problem is that the 'Director' field
should appear in two places. At the top as 'Memo From' and also in the
signature. I have placed the bookmark in the first location and then tried to
reference the bookmark to the signature but it wont work. The name is
inserted 'inside' the bookmark if that helps.
For the reference I have used { REF "Director"} , { Director }, { REF
Director}, {"Director"} but nothing. As a temporary work around I added a
line of code to the command button so that it places Director at a new
bookmark created in the signature as well as the original bookmark.

Also, I had this document working using Fill-ins and underneath the
signature line I had a number of IF's to complete the directors title such as
{ IF "{ Director }" = "John Smith" "Managing Director" ""}{IF "{ Director }"
= "Mark Jones" "Financial Director" ""} and that completed the title for the
signature. This doesn't work either now that I have utilised a UserForm.

Any help will be much appreciated.
 
J

Jonathan West

Pyrite said:
I have created a UserForm for a template document. There are four fields
which are completed in this manner. The problem is that the 'Director'
field
should appear in two places. At the top as 'Memo From' and also in the
signature. I have placed the bookmark in the first location and then tried
to
reference the bookmark to the signature but it wont work. The name is
inserted 'inside' the bookmark if that helps.
For the reference I have used { REF "Director"} , { Director }, { REF
Director}, {"Director"} but nothing. As a temporary work around I added a
line of code to the command button so that it places Director at a new
bookmark created in the signature as well as the original bookmark.

Also, I had this document working using Fill-ins and underneath the
signature line I had a number of IF's to complete the directors title such
as
{ IF "{ Director }" = "John Smith" "Managing Director" ""}{IF "{
Director }"
= "Mark Jones" "Financial Director" ""} and that completed the title for
the
signature. This doesn't work either now that I have utilised a UserForm.

Any help will be much appreciated.

Where text has to go into multiple places, instead of using bookmarks, I
tend to use custom document properties and DOCPROPERTY fields

In your template, go to File, Properties, to display the Properties dialog.
Click the Custom tab. Create a property called "Director" and put some text
into it.

Then at the relevant places in your document, insert a DOCPROPERTY field
pointing to the "Director" property.

Then in your code, where you had something like this

ActiveDocument.Bookmarks("Director").Range.InsertBefore TextBox1

Instead you put this

ActiveDocument.CustomDocumentProperties("Director") = TextBox1

Repeat as necessary for any other properties you want to handle in the same
way.

When all the properties have been set, add this like of code to make sure
that all the fields have been updated to reflect the contents of the
properties they reference

ActiveDocument.Fields.Update
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top