View Single Post
  #11   Report Post  
Posted to microsoft.public.word.docmanagement
Yannick Yannick is offline
external usenet poster
 
Posts: 7
Default How to generate a document chosing different sections from a t

That's exactly what I wanted.
Thanks a lot Graham!

Yannick

"Graham Mayor" wrote:

In the circumstances it might be better to set up a simple userform.

Imagine a userform with three check boxes and a command button (each with
their default names). The macro associated with the form command button
could be (at its simplest)

Private Sub CommandButton1_Click()
Unload Me
If Me.CheckBox1.Value = True Then
Selection.InsertFile FileName:="D:\My Documents\Doc1.docx"
End If
If Me.CheckBox2.Value = True Then
Selection.InsertFile FileName:="D:\My Documents\Doc2.docx"
End If
If Me.CheckBox3.Value = True Then
Selection.InsertFile FileName:="D:\My Documents\Doc3.docx"
End If
End Sub

which will insert the documents into the current document in the order shown
according to which check box is checked. Embroider to suit your application.
For the basics, see Word MVP FAQ - Userforms
http://word.mvps.org/FAQs/Userforms.htm

for a more in depth explanation, see
http://gregmaxey.mvps.org/Create_and...a_UserForm.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



"Yannick" wrote in message
...
Thanks Graham. It seems it might help me. However, I am a dummy in
Macros...
So I would need furthr help.
I succeeded in creating a form with "CheckBox1", displaying the content of
"Doc1.doc" if checked, "CheckBox2", displaying the content of "Doc2.doc"
if
checked, ... But what I did is to create a separate macro for every
checkbox.
How could I do only one macro, which would display the content of
"DocX.doc"
if "CheckBoxX" is checked (X being variable) (and do not display anything
if
not checked). I guess I have to do a "For Each..." but I don't know
more...
If you can hlep me on this, it would be wonderful!

Thanks already

"Graham Mayor" wrote:

See http://www.gmayor.com/SelectFile.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



"Yannick" wrote in message
...
OK, the title might not be so clear, so I will explain what I try to
do.
I want to create a template document from which specific documents will
be
produced. So, for example, in my template document, I have 10 different
sections (parts of the document, no matter if it is identified as a
section
or as something else). Then, from this template, I want to create a
document
containing only sections 1, 3, 4, 8, another one with sections 1, 10,
and
a
last one with sections 2, 3, 7, 9, 10.
Ideally, I would like to be able to generate these documents quickly,
by
doing something like: "Create new document from the template xxx" and
then
just check the desired sections in a list.
Maybe am I dreaming, but I guess I am not the first one wanting to do
such
a
thing.
So, is it possible? How?
Any help is appreciated.
Thank you in advance



.



.