Miina said:
I´m not sure how to explain my problem. I´m making a contract with different
paragraphs and parts in it. It is a general contract but it would be used to
many purposes. I would like it to be so that you can choose in the beginning
wich parts and paragraphs of the contract you want to use and it the document
would be automatically biuilt according to those wishes. Is this possible and
if it is, how?
Yes it is.
This requires VBA knowledge and a good understanding of how Word documents
are built.
I would recommend that you contact someone who has the aforementioned
knowledge.
If, however, you want to do this on your own, then you would need to build a
userform so that the user can select the content with checkboxes.
Next, depending on how you want to handle this, you have 2 options:
1) This is a one shot deal, i.e., the user decides when creating the
document what is needed and you then build the document accordingly, no going
back! In this scenario, use bookmarks to identify each part, and then delete
the bookmark ranges that correspond to checkboxes that were not selected.
2) The user can later decide to remove/add sections that were mistakenly
included/removed when creating the document. Again, bookmarks will be needed,
but each part will need to be saved as an Autotext entry as well. When first
displaying the userfrom, all checboxes are "unselected". The user makes
choices and you proceed as with scenario "1)" above. Later, when the user
decides to edit the content, the userform is displayed again, but this time
you scan the document first. For all bookmarks that are found in the document
you need to check their corresponding checkboxes on the userform to show the
user the current content. Then, you modify the document accordingly (Add new
sections that were checked, remove those that were first checked but are not
anymore). This scenario is more involved and will need a lot more code than
the first one. However, it offers complete control to the user. If I were
selling this to a client, I would push this scenrario as it would be
appreciated by users, even if it were more costly to produce due to the fact
that mode code is needed.
See here for help on creating userforms:
http://word.mvps.org/faqs/Userforms/index.htm