Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
יריב החביב יריב החביב is offline
external usenet poster
 
Posts: 15
Default Word Merge - All At One

Hello,

We have to merge 30 letters to one data source .

The letters are separate entity.

Is there any way to do it in one action insted of every letter seperately ?

if the answer is Yes, please tell me how.

thank you

--
תודה רבה
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Word Merge - All At One

That's what mailmerge does? See
http://www.gmayor.com/mail_merge_lab...th_word_xp.htm or
http://www.gmayor.com/merge_labels_with_word_2007.htm

If you want to end up with a separate document for each record, see also
http://www.gmayor.com/individual_merge_letters.htm

--

Graham Mayor - Word MVP

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



???? ????? wrote:
Hello,

We have to merge 30 letters to one data source .

The letters are separate entity.

Is there any way to do it in one action insted of every letter
seperately ?

if the answer is Yes, please tell me how.

thank you



  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Word Merge - All At One

If you are trying to ensure that the output for each recipient is all
produced together, then the simplest approach is /probably/ to combine all
the letters into a single document and merge that, particularly if this
operation needs to be repeated periodically. My guess is that the approach
where you automate the process so that you open each document and merge one
record, the repeat the process, is likely to be harder to get right.

However, if you also need to use different paper for first page/subsequent
pages and that kind of thing you will need to test that you can do that with
the printer(s) you are using.

--
Peter Jamieson
http://tips.pjmsn.me.uk

"יריב החביב" wrote in message
...
Hello,

We have to merge 30 letters to one data source .

The letters are separate entity.

Is there any way to do it in one action insted of every letter seperately
?

if the answer is Yes, please tell me how.

thank you

--
תודה רבה


  #4   Report Post  
Posted to microsoft.public.word.docmanagement
יריב החביב יריב החביב is offline
external usenet poster
 
Posts: 15
Default Word Merge - All At One

thank you Graham, But it is still not answer

my question (or that i don't understand ...)

Is there a way to "Choose the data source" (one datasource)

for 30 letter's in one action (instead of choosing the datasource seperately
for each letter) ???

thank you
--
תודה רבה


"Graham Mayor" wrote:

That's what mailmerge does? See
http://www.gmayor.com/mail_merge_lab...th_word_xp.htm or
http://www.gmayor.com/merge_labels_with_word_2007.htm

If you want to end up with a separate document for each record, see also
http://www.gmayor.com/individual_merge_letters.htm

--

Graham Mayor - Word MVP

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



???? ????? wrote:
Hello,

We have to merge 30 letters to one data source .

The letters are separate entity.

Is there any way to do it in one action insted of every letter
seperately ?

if the answer is Yes, please tell me how.

thank you




  #5   Report Post  
Posted to microsoft.public.word.docmanagement
יריב החביב יריב החביב is offline
external usenet poster
 
Posts: 15
Default Word Merge - All At One

Thank you Peter,

But I must leave the letter's separately

Because on each production of a letter the datasource (from access) is
changing

and only one leeter is producing
--
תודה רבה


"Peter Jamieson" wrote:

If you are trying to ensure that the output for each recipient is all
produced together, then the simplest approach is /probably/ to combine all
the letters into a single document and merge that, particularly if this
operation needs to be repeated periodically. My guess is that the approach
where you automate the process so that you open each document and merge one
record, the repeat the process, is likely to be harder to get right.

However, if you also need to use different paper for first page/subsequent
pages and that kind of thing you will need to test that you can do that with
the printer(s) you are using.

--
Peter Jamieson
http://tips.pjmsn.me.uk

"יריב החביב" wrote in message
...
Hello,

We have to merge 30 letters to one data source .

The letters are separate entity.

Is there any way to do it in one action insted of every letter seperately
?

if the answer is Yes, please tell me how.

thank you

--
תודה רבה





  #6   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Word Merge - All At One

Now it is my turn not to understand

The principle of mail merge is that you create a standard letter with the
text common to all and attach the data source to insert the variable
information from that data source. Thus if there are thirty records in your
data source you will get thirty letters.

--

Graham Mayor - Word MVP

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




???? ????? wrote:
thank you Graham, But it is still not answer

my question (or that i don't understand ...)

Is there a way to "Choose the data source" (one datasource)

for 30 letter's in one action (instead of choosing the datasource
seperately for each letter) ???

thank you

That's what mailmerge does? See
http://www.gmayor.com/mail_merge_lab...th_word_xp.htm or
http://www.gmayor.com/merge_labels_with_word_2007.htm

If you want to end up with a separate document for each record, see
also http://www.gmayor.com/individual_merge_letters.htm

--

Graham Mayor - Word MVP

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



???? ????? wrote:
Hello,

We have to merge 30 letters to one data source .

The letters are separate entity.

Is there any way to do it in one action insted of every letter
seperately ?

if the answer is Yes, please tell me how.

thank you



  #7   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Word Merge - All At One

I gather that what you are doing is creating multiple letters, each one
containing different text, but each one populated with data from the same
one record in the data source. While mail merge can be made to do that, it
is not the intended purpose of mailmerge.

Instead of using mailmerge, I would have a template for each letter and I
would use VBA code to create a letter from each template and populate
docvariable fields in each letter with the appropriate data from the data
source.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"???? ?????" wrote in message
...
Thank you Peter,

But I must leave the letter's separately

Because on each production of a letter the datasource (from access) is
changing

and only one leeter is producing
--
???? ???


"Peter Jamieson" wrote:

If you are trying to ensure that the output for each recipient is all
produced together, then the simplest approach is /probably/ to combine
all
the letters into a single document and merge that, particularly if this
operation needs to be repeated periodically. My guess is that the
approach
where you automate the process so that you open each document and merge
one
record, the repeat the process, is likely to be harder to get right.

However, if you also need to use different paper for first
page/subsequent
pages and that kind of thing you will need to test that you can do that
with
the printer(s) you are using.

--
Peter Jamieson
http://tips.pjmsn.me.uk

"???? ?????" wrote in message
...
Hello,

We have to merge 30 letters to one data source .

The letters are separate entity.

Is there any way to do it in one action insted of every letter
seperately
?

if the answer is Yes, please tell me how.

thank you

--
???? ???





  #8   Report Post  
Posted to microsoft.public.word.docmanagement
יריב החביב יריב החביב is offline
external usenet poster
 
Posts: 15
Default Word Merge - All At One

Yes,
i have 30 standard letter's and i want them as they are (30 standard . . .)

but i want them to use the same datasource, and i want to save time

by choose this datasource for all of them in one action, instead of each
letter

seperately.

THANK YOU



תודה רבה


"Graham Mayor" wrote:

Now it is my turn not to understand

The principle of mail merge is that you create a standard letter with the
text common to all and attach the data source to insert the variable
information from that data source. Thus if there are thirty records in your
data source you will get thirty letters.

--

Graham Mayor - Word MVP

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




???? ????? wrote:
thank you Graham, But it is still not answer

my question (or that i don't understand ...)

Is there a way to "Choose the data source" (one datasource)

for 30 letter's in one action (instead of choosing the datasource
seperately for each letter) ???

thank you

That's what mailmerge does? See
http://www.gmayor.com/mail_merge_lab...th_word_xp.htm or
http://www.gmayor.com/merge_labels_with_word_2007.htm

If you want to end up with a separate document for each record, see
also http://www.gmayor.com/individual_merge_letters.htm

--

Graham Mayor - Word MVP

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



???? ????? wrote:
Hello,

We have to merge 30 letters to one data source .

The letters are separate entity.

Is there any way to do it in one action insted of every letter
seperately ?

if the answer is Yes, please tell me how.

thank you




  #9   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Word Merge - All At One

The following macro will attach the same data source - here "D:\My
Documents\Test\Names Data.doc"
to all the files in a folder selected from the dialog.

Dim fDialog As FileDialog
Dim DataFile As String
DataFile = "D:\My Documents\Test\Names Data.doc"

Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
With fDialog
.Title = "Select Folder containing the letters and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User"
Exit Sub
End If
DocDir = .SelectedItems.Item(1)
If Right(DocDir, 1) "\" Then DocDir = DocDir + "\"
End With
On Error Resume Next

If Documents.Count 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If

DocList = Dir$(DocDir & "*.doc")
Do While DocList ""
Documents.Open DocList
With ActiveDocument.MailMerge
.MainDocumentType = wdFormLetters
.OpenDataSource DataFile
End With
Documents.Close wdSaveChanges
DocList = Dir$()
Loop


--

Graham Mayor - Word MVP

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




???? ????? wrote:
Yes,
i have 30 standard letter's and i want them as they are (30 standard
. . .)

but i want them to use the same datasource, and i want to save time

by choose this datasource for all of them in one action, instead of
each letter

seperately.

THANK YOU



???? ???


"Graham Mayor" wrote:

Now it is my turn not to understand

The principle of mail merge is that you create a standard letter
with the text common to all and attach the data source to insert the
variable information from that data source. Thus if there are thirty
records in your data source you will get thirty letters.

--

Graham Mayor - Word MVP

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




???? ????? wrote:
thank you Graham, But it is still not answer

my question (or that i don't understand ...)

Is there a way to "Choose the data source" (one datasource)

for 30 letter's in one action (instead of choosing the datasource
seperately for each letter) ???

thank you

That's what mailmerge does? See
http://www.gmayor.com/mail_merge_lab...th_word_xp.htm or
http://www.gmayor.com/merge_labels_with_word_2007.htm

If you want to end up with a separate document for each record, see
also http://www.gmayor.com/individual_merge_letters.htm

--

Graham Mayor - Word MVP

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



???? ????? wrote:
Hello,

We have to merge 30 letters to one data source .

The letters are separate entity.

Is there any way to do it in one action insted of every letter
seperately ?

if the answer is Yes, please tell me how.

thank you



  #10   Report Post  
Posted to microsoft.public.word.docmanagement
יריב החביב יריב החביב is offline
external usenet poster
 
Posts: 15
Default Word Merge - All At One

thank you,

it is geting closer but i still have not reach the target.

the dialog box open and i can select the folder but i dont see the files
(letters)

i choose the folder (without seeing the files)

and it run, but finaly the letters not conected to the data source)
--
תודה רבה


"Graham Mayor" wrote:

The following macro will attach the same data source - here "D:\My
Documents\Test\Names Data.doc"
to all the files in a folder selected from the dialog.

Dim fDialog As FileDialog
Dim DataFile As String
DataFile = "D:\My Documents\Test\Names Data.doc"

Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
With fDialog
.Title = "Select Folder containing the letters and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User"
Exit Sub
End If
DocDir = .SelectedItems.Item(1)
If Right(DocDir, 1) "\" Then DocDir = DocDir + "\"
End With
On Error Resume Next

If Documents.Count 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If

DocList = Dir$(DocDir & "*.doc")
Do While DocList ""
Documents.Open DocList
With ActiveDocument.MailMerge
.MainDocumentType = wdFormLetters
.OpenDataSource DataFile
End With
Documents.Close wdSaveChanges
DocList = Dir$()
Loop


--

Graham Mayor - Word MVP

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




???? ????? wrote:
Yes,
i have 30 standard letter's and i want them as they are (30 standard
. . .)

but i want them to use the same datasource, and i want to save time

by choose this datasource for all of them in one action, instead of
each letter

seperately.

THANK YOU



???? ???


"Graham Mayor" wrote:

Now it is my turn not to understand

The principle of mail merge is that you create a standard letter
with the text common to all and attach the data source to insert the
variable information from that data source. Thus if there are thirty
records in your data source you will get thirty letters.

--

Graham Mayor - Word MVP

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




???? ????? wrote:
thank you Graham, But it is still not answer

my question (or that i don't understand ...)

Is there a way to "Choose the data source" (one datasource)

for 30 letter's in one action (instead of choosing the datasource
seperately for each letter) ???

thank you

That's what mailmerge does? See
http://www.gmayor.com/mail_merge_lab...th_word_xp.htm or
http://www.gmayor.com/merge_labels_with_word_2007.htm

If you want to end up with a separate document for each record, see
also http://www.gmayor.com/individual_merge_letters.htm

--

Graham Mayor - Word MVP

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



???? ????? wrote:
Hello,

We have to merge 30 letters to one data source .

The letters are separate entity.

Is there any way to do it in one action insted of every letter
seperately ?

if the answer is Yes, please tell me how.

thank you






  #11   Report Post  
Posted to microsoft.public.word.docmanagement
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Word Merge - All At One

You could try making a couple of changes to Graham's suggested code,
something like the following. This updates the mail merge data source for
each file, then performs the merge immediately.

Dim fDialog As FileDialog
Dim DataFile As String
' I prefer to store a reference to the documents the code is working with
Dim oDoc As Word.Document
DataFile = "D:\My Documents\Test\Names Data.doc"

Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
With fDialog
.Title = "Select Folder containing the letters and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User"
Exit Sub
End If
DocDir = .SelectedItems.Item(1)
If Right(DocDir, 1) "\" Then DocDir = DocDir + "\"
End With
On Error Resume Next

If Documents.Count 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If

' All the changes are in this part
DocList = Dir$(DocDir & "*.doc")
Do While DocList ""
Set oDoc = Documents.Open(DocList)
With oDoc.MailMerge
.MainDocumentType = wdFormLetters
.OpenDataSource DataFile
.Destination = wdSendToPrinter
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
End With
' If you don't actually need to save the new data source do this
oDoc.Close wdDoNotSaveChanges
' But if you might need to re-run the merge agains thte data source you are
currently using, do this
' oDoc.Close wdSaveChanges
Set oDoc = Nothing
DocList = Dir$()
Loop


--
Peter Jamieson
http://tips.pjmsn.me.uk

"יריב החביב" wrote in message
...
thank you,

it is geting closer but i still have not reach the target.

the dialog box open and i can select the folder but i dont see the files
(letters)

i choose the folder (without seeing the files)

and it run, but finaly the letters not conected to the data source)
--
תודה רבה


"Graham Mayor" wrote:

The following macro will attach the same data source - here "D:\My
Documents\Test\Names Data.doc"
to all the files in a folder selected from the dialog.

Dim fDialog As FileDialog
Dim DataFile As String
DataFile = "D:\My Documents\Test\Names Data.doc"

Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
With fDialog
.Title = "Select Folder containing the letters and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User"
Exit Sub
End If
DocDir = .SelectedItems.Item(1)
If Right(DocDir, 1) "\" Then DocDir = DocDir + "\"
End With
On Error Resume Next

If Documents.Count 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If

DocList = Dir$(DocDir & "*.doc")
Do While DocList ""
Documents.Open DocList
With ActiveDocument.MailMerge
.MainDocumentType = wdFormLetters
.OpenDataSource DataFile
End With
Documents.Close wdSaveChanges
DocList = Dir$()
Loop


--

Graham Mayor - Word MVP

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




???? ????? wrote:
Yes,
i have 30 standard letter's and i want them as they are (30 standard
. . .)

but i want them to use the same datasource, and i want to save time

by choose this datasource for all of them in one action, instead of
each letter

seperately.

THANK YOU



???? ???


"Graham Mayor" wrote:

Now it is my turn not to understand

The principle of mail merge is that you create a standard letter
with the text common to all and attach the data source to insert the
variable information from that data source. Thus if there are thirty
records in your data source you will get thirty letters.

--

Graham Mayor - Word MVP

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




???? ????? wrote:
thank you Graham, But it is still not answer

my question (or that i don't understand ...)

Is there a way to "Choose the data source" (one datasource)

for 30 letter's in one action (instead of choosing the datasource
seperately for each letter) ???

thank you

That's what mailmerge does? See
http://www.gmayor.com/mail_merge_lab...th_word_xp.htm or
http://www.gmayor.com/merge_labels_with_word_2007.htm

If you want to end up with a separate document for each record, see
also http://www.gmayor.com/individual_merge_letters.htm

--

Graham Mayor - Word MVP

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



???? ????? wrote:
Hello,

We have to merge 30 letters to one data source .

The letters are separate entity.

Is there any way to do it in one action insted of every letter
seperately ?

if the answer is Yes, please tell me how.

thank you





  #12   Report Post  
Posted to microsoft.public.word.docmanagement
Suzanne S. Barnhill Suzanne S. Barnhill is offline
external usenet poster
 
Posts: 33,624
Default Word Merge - All At One

Or the letters could use IncludeText fields to pull bookmarked text from a
source document, which could be updated as needed.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

"Doug Robbins - Word MVP" wrote in message
...
I gather that what you are doing is creating multiple letters, each one
containing different text, but each one populated with data from the same
one record in the data source. While mail merge can be made to do that, it
is not the intended purpose of mailmerge.

Instead of using mailmerge, I would have a template for each letter and I
would use VBA code to create a letter from each template and populate
docvariable fields in each letter with the appropriate data from the data
source.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"???? ?????" wrote in message
...
Thank you Peter,

But I must leave the letter's separately

Because on each production of a letter the datasource (from access) is
changing

and only one leeter is producing
--
???? ???


"Peter Jamieson" wrote:

If you are trying to ensure that the output for each recipient is all
produced together, then the simplest approach is /probably/ to combine
all
the letters into a single document and merge that, particularly if this
operation needs to be repeated periodically. My guess is that the
approach
where you automate the process so that you open each document and merge
one
record, the repeat the process, is likely to be harder to get right.

However, if you also need to use different paper for first
page/subsequent
pages and that kind of thing you will need to test that you can do that
with
the printer(s) you are using.

--
Peter Jamieson
http://tips.pjmsn.me.uk

"???? ?????" wrote in message
...
Hello,

We have to merge 30 letters to one data source .

The letters are separate entity.

Is there any way to do it in one action insted of every letter
seperately
?

if the answer is Yes, please tell me how.

thank you

--
???? ???







  #13   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Word Merge - All At One

You are not supposed to see the files. The macro assumes that you know where
they are saved. It runs on ALL the files in the folder. See Peter's
contribution to the thread.

--

Graham Mayor - Word MVP

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



???? ????? wrote:
thank you,

it is geting closer but i still have not reach the target.

the dialog box open and i can select the folder but i dont see the
files (letters)

i choose the folder (without seeing the files)

and it run, but finaly the letters not conected to the data source)

The following macro will attach the same data source - here "D:\My
Documents\Test\Names Data.doc"
to all the files in a folder selected from the dialog.

Dim fDialog As FileDialog
Dim DataFile As String
DataFile = "D:\My Documents\Test\Names Data.doc"

Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
With fDialog
.Title = "Select Folder containing the letters and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User"
Exit Sub
End If
DocDir = .SelectedItems.Item(1)
If Right(DocDir, 1) "\" Then DocDir = DocDir + "\"
End With
On Error Resume Next

If Documents.Count 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If

DocList = Dir$(DocDir & "*.doc")
Do While DocList ""
Documents.Open DocList
With ActiveDocument.MailMerge
.MainDocumentType = wdFormLetters
.OpenDataSource DataFile
End With
Documents.Close wdSaveChanges
DocList = Dir$()
Loop


--

Graham Mayor - Word MVP

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




???? ????? wrote:
Yes,
i have 30 standard letter's and i want them as they are (30 standard
. . .)

but i want them to use the same datasource, and i want to save time

by choose this datasource for all of them in one action, instead of
each letter

seperately.

THANK YOU



???? ???


"Graham Mayor" wrote:

Now it is my turn not to understand

The principle of mail merge is that you create a standard letter
with the text common to all and attach the data source to insert
the variable information from that data source. Thus if there are
thirty records in your data source you will get thirty letters.

--

Graham Mayor - Word MVP

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




???? ????? wrote:
thank you Graham, But it is still not answer

my question (or that i don't understand ...)

Is there a way to "Choose the data source" (one datasource)

for 30 letter's in one action (instead of choosing the datasource
seperately for each letter) ???

thank you

That's what mailmerge does? See
http://www.gmayor.com/mail_merge_lab...th_word_xp.htm or
http://www.gmayor.com/merge_labels_with_word_2007.htm

If you want to end up with a separate document for each record,
see also http://www.gmayor.com/individual_merge_letters.htm

--

Graham Mayor - Word MVP

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



???? ????? wrote:
Hello,

We have to merge 30 letters to one data source .

The letters are separate entity.

Is there any way to do it in one action insted of every letter
seperately ?

if the answer is Yes, please tell me how.

thank you



  #14   Report Post  
Posted to microsoft.public.word.docmanagement
יריב החביב יריב החביב is offline
external usenet poster
 
Posts: 15
Default Word Merge - All At One

thank you

I think i get closer, now another dialog box open and

ask me to select table (excel sheet's - i changed the suffix code of the
place of the

source to .xls ) for every word document that i have

in the file, but still the document's not conected to the source
--
תודה רבה


"Peter Jamieson" wrote:

You could try making a couple of changes to Graham's suggested code,
something like the following. This updates the mail merge data source for
each file, then performs the merge immediately.

Dim fDialog As FileDialog
Dim DataFile As String
' I prefer to store a reference to the documents the code is working with
Dim oDoc As Word.Document
DataFile = "D:\My Documents\Test\Names Data.doc"

Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
With fDialog
.Title = "Select Folder containing the letters and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User"
Exit Sub
End If
DocDir = .SelectedItems.Item(1)
If Right(DocDir, 1) "\" Then DocDir = DocDir + "\"
End With
On Error Resume Next

If Documents.Count 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If

' All the changes are in this part
DocList = Dir$(DocDir & "*.doc")
Do While DocList ""
Set oDoc = Documents.Open(DocList)
With oDoc.MailMerge
.MainDocumentType = wdFormLetters
.OpenDataSource DataFile
.Destination = wdSendToPrinter
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
End With
' If you don't actually need to save the new data source do this
oDoc.Close wdDoNotSaveChanges
' But if you might need to re-run the merge agains thte data source you are
currently using, do this
' oDoc.Close wdSaveChanges
Set oDoc = Nothing
DocList = Dir$()
Loop


--
Peter Jamieson
http://tips.pjmsn.me.uk

"יריב החביב" wrote in message
...
thank you,

it is geting closer but i still have not reach the target.

the dialog box open and i can select the folder but i dont see the files
(letters)

i choose the folder (without seeing the files)

and it run, but finaly the letters not conected to the data source)
--
תודה רבה


"Graham Mayor" wrote:

The following macro will attach the same data source - here "D:\My
Documents\Test\Names Data.doc"
to all the files in a folder selected from the dialog.

Dim fDialog As FileDialog
Dim DataFile As String
DataFile = "D:\My Documents\Test\Names Data.doc"

Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
With fDialog
.Title = "Select Folder containing the letters and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User"
Exit Sub
End If
DocDir = .SelectedItems.Item(1)
If Right(DocDir, 1) "\" Then DocDir = DocDir + "\"
End With
On Error Resume Next

If Documents.Count 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If

DocList = Dir$(DocDir & "*.doc")
Do While DocList ""
Documents.Open DocList
With ActiveDocument.MailMerge
.MainDocumentType = wdFormLetters
.OpenDataSource DataFile
End With
Documents.Close wdSaveChanges
DocList = Dir$()
Loop


--

Graham Mayor - Word MVP

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




???? ????? wrote:
Yes,
i have 30 standard letter's and i want them as they are (30 standard
. . .)

but i want them to use the same datasource, and i want to save time

by choose this datasource for all of them in one action, instead of
each letter

seperately.

THANK YOU



???? ???


"Graham Mayor" wrote:

Now it is my turn not to understand

The principle of mail merge is that you create a standard letter
with the text common to all and attach the data source to insert the
variable information from that data source. Thus if there are thirty
records in your data source you will get thirty letters.

--

Graham Mayor - Word MVP

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




???? ????? wrote:
thank you Graham, But it is still not answer

my question (or that i don't understand ...)

Is there a way to "Choose the data source" (one datasource)

for 30 letter's in one action (instead of choosing the datasource
seperately for each letter) ???

thank you

That's what mailmerge does? See
http://www.gmayor.com/mail_merge_lab...th_word_xp.htm or
http://www.gmayor.com/merge_labels_with_word_2007.htm

If you want to end up with a separate document for each record, see
also http://www.gmayor.com/individual_merge_letters.htm

--

Graham Mayor - Word MVP

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



???? ????? wrote:
Hello,

We have to merge 30 letters to one data source .

The letters are separate entity.

Is there any way to do it in one action insted of every letter
seperately ?

if the answer is Yes, please tell me how.

thank you





  #15   Report Post  
Posted to microsoft.public.word.docmanagement
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Word Merge - All At One

in the file, but still the document's not conected to the source

You may need to follow the instructions he

http://support.microsoft.com/kb/825765/en-us

ask me to select table (excel sheet's - i changed the suffix code of the
place of the

source to .xls ) for every word document that i have


For .xls sources try replacing

..OpenDataSource DataFile

with this

' you can put these at the top of your macro if you prefer
Dim strSheetName As String
strSheetName = "Sheet4"

..OpenDataSource _
Name:=DataFile, _
SQLStatement:="SELECT * FROM [" & strSheetName & "$]"
--
Peter Jamieson
http://tips.pjmsn.me.uk

"יריב החביב" wrote in message
...
thank you

I think i get closer, now another dialog box open and

ask me to select table (excel sheet's - i changed the suffix code of the
place of the

source to .xls ) for every word document that i have

in the file, but still the document's not conected to the source
--
תודה רבה


"Peter Jamieson" wrote:

You could try making a couple of changes to Graham's suggested code,
something like the following. This updates the mail merge data source for
each file, then performs the merge immediately.

Dim fDialog As FileDialog
Dim DataFile As String
' I prefer to store a reference to the documents the code is working with
Dim oDoc As Word.Document
DataFile = "D:\My Documents\Test\Names Data.doc"

Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
With fDialog
.Title = "Select Folder containing the letters and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User"
Exit Sub
End If
DocDir = .SelectedItems.Item(1)
If Right(DocDir, 1) "\" Then DocDir = DocDir + "\"
End With
On Error Resume Next

If Documents.Count 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If

' All the changes are in this part
DocList = Dir$(DocDir & "*.doc")
Do While DocList ""
Set oDoc = Documents.Open(DocList)
With oDoc.MailMerge
.MainDocumentType = wdFormLetters
.OpenDataSource DataFile
.Destination = wdSendToPrinter
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
End With
' If you don't actually need to save the new data source do this
oDoc.Close wdDoNotSaveChanges
' But if you might need to re-run the merge agains thte data source you
are
currently using, do this
' oDoc.Close wdSaveChanges
Set oDoc = Nothing
DocList = Dir$()
Loop


--
Peter Jamieson
http://tips.pjmsn.me.uk

"יריב החביב" wrote in message
...
thank you,

it is geting closer but i still have not reach the target.

the dialog box open and i can select the folder but i dont see the
files
(letters)

i choose the folder (without seeing the files)

and it run, but finaly the letters not conected to the data source)
--
תודה רבה


"Graham Mayor" wrote:

The following macro will attach the same data source - here "D:\My
Documents\Test\Names Data.doc"
to all the files in a folder selected from the dialog.

Dim fDialog As FileDialog
Dim DataFile As String
DataFile = "D:\My Documents\Test\Names Data.doc"

Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
With fDialog
.Title = "Select Folder containing the letters and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User"
Exit Sub
End If
DocDir = .SelectedItems.Item(1)
If Right(DocDir, 1) "\" Then DocDir = DocDir + "\"
End With
On Error Resume Next

If Documents.Count 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If

DocList = Dir$(DocDir & "*.doc")
Do While DocList ""
Documents.Open DocList
With ActiveDocument.MailMerge
.MainDocumentType = wdFormLetters
.OpenDataSource DataFile
End With
Documents.Close wdSaveChanges
DocList = Dir$()
Loop


--

Graham Mayor - Word MVP

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




???? ????? wrote:
Yes,
i have 30 standard letter's and i want them as they are (30 standard
. . .)

but i want them to use the same datasource, and i want to save time

by choose this datasource for all of them in one action, instead of
each letter

seperately.

THANK YOU



???? ???


"Graham Mayor" wrote:

Now it is my turn not to understand

The principle of mail merge is that you create a standard letter
with the text common to all and attach the data source to insert
the
variable information from that data source. Thus if there are
thirty
records in your data source you will get thirty letters.

--

Graham Mayor - Word MVP

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




???? ????? wrote:
thank you Graham, But it is still not answer

my question (or that i don't understand ...)

Is there a way to "Choose the data source" (one datasource)

for 30 letter's in one action (instead of choosing the datasource
seperately for each letter) ???

thank you

That's what mailmerge does? See
http://www.gmayor.com/mail_merge_lab...th_word_xp.htm or
http://www.gmayor.com/merge_labels_with_word_2007.htm

If you want to end up with a separate document for each record,
see
also http://www.gmayor.com/individual_merge_letters.htm

--

Graham Mayor - Word MVP

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



???? ????? wrote:
Hello,

We have to merge 30 letters to one data source .

The letters are separate entity.

Is there any way to do it in one action insted of every letter
seperately ?

if the answer is Yes, please tell me how.

thank you






Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Word 2003 pulls up my mail merge template, but doesn't complete the merge into a new Form Letter 1 Sean Steele Mailmerge 1 April 12th 07 11:04 PM
Problem with merge data to word document merge field DB Microsoft Word Help 1 September 14th 06 11:18 PM
How to merge Excel chart for mass Word Mail Merge for employees hmboomer Mailmerge 3 June 9th 06 10:08 PM
Maniplulating the data source location of a merge, MS Word merge MCubitt Mailmerge 6 June 24th 05 10:33 AM
Insert Merge Field problem with Word-Mail Merge from Excel documen Augusta E. Microsoft Word Help 2 June 20th 05 10:59 AM


All times are GMT +1. The time now is 11:50 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"