Home |
Search |
Today's Posts |
|
#1
|
|||
|
|||
"Printing" selected "reocrds" to a word document
I have a data base that contains all the information need to produce church
bulletins for the coming year. I have a word template that nicely merges everything together. However, this is not the final product for the pews. Others are involved. I need to send in the merged document, and they have requested that it come as an MS Word document. 1. How do "print" to a Word document? If I just cut and paste, the field associations remain. 2. Is there a command to output a range of records? Right now it only does the currently displayed record. I'm not sure that this is exactly on topic since its not a mail merge situation, but rather some other kind of use the data from Access in a Word document mess. (Working Sunday by Sunday and printing the bulletins myself this made sense and worked, but I'm not longer in the final production game.) Regards, Al |
#2
|
|||
|
|||
If the template is a mailmerge main document, execute the merge to a new
document. If you want to split that document into separate files, one for each record in the data base, you can use either of the following methods: ' Macro created by Doug Robbins to save each letter created by a mailmerge as a separate file. Dim i As Long, Source as Document, Target as Document, Letter as Range Set Source = ActiveDocument For i = 1 to Source.Sections.Count Set Letter = Source.Sections(i).Range Letter.End=Letter.End-1 Set Target = Documents.Add Target.Range=Letter Target.SaveAs FileName:="Letter" & i Target.Close Next i If you want each file to be named based on one of the fields in the data source, here's a method that I have used that involves creating a separate catalog type mailmerge maindocument which creates a word document containing a table in each row of which would be your data from the database that you want to use as the filename. You first execute that mailmerge, then save that file and close it. Then execute the mailmerge that you want to create the separate files from and with the result of that on the screen, run a macro containing the following code and when the File open dialog appears, select the file containing the table created by the first mailmerge ' Throw Away Macro created by Doug Robbins ' Dim Source As Document, oblist As Document, DocName As Range, DocumentName As String Dim i As Long, doctext As Range, target As Document Set Source = ActiveDocument With Dialogs(wdDialogFileOpen) .Show End With Set oblist = ActiveDocument Counter = 1 For i = 1 To oblist.Tables(1).Rows.Count Set DocName = oblist.Tables(1).Cell(i, 1).Range DocName.End = DocName.End - 1 'Change the path in the following command to suit where you want to save the documents. DocumentName = "I:\WorkArea\Documentum\" & DocName.Text Set doctext = Source.Sections(i).Range doctext.End = doctext.End - 1 Set target = Documents.Add target.Range.FormattedText = doctext target.SaveAs FileName:=DocumentName target.Close Next i -- 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 "Al Christoph" wrote in message ... I have a data base that contains all the information need to produce church bulletins for the coming year. I have a word template that nicely merges everything together. However, this is not the final product for the pews. Others are involved. I need to send in the merged document, and they have requested that it come as an MS Word document. 1. How do "print" to a Word document? If I just cut and paste, the field associations remain. 2. Is there a command to output a range of records? Right now it only does the currently displayed record. I'm not sure that this is exactly on topic since its not a mail merge situation, but rather some other kind of use the data from Access in a Word document mess. (Working Sunday by Sunday and printing the bulletins myself this made sense and worked, but I'm not longer in the final production game.) Regards, Al |
#3
|
|||
|
|||
Thanks,
You got me digging and i found exactly what I by running the wizard. Don't think I've ever done it in the current releases. Regards, Al "Doug Robbins" wrote in message ... If the template is a mailmerge main document, execute the merge to a new document. If you want to split that document into separate files, one for each record in the data base, you can use either of the following methods: ' Macro created by Doug Robbins to save each letter created by a mailmerge as a separate file. Dim i As Long, Source as Document, Target as Document, Letter as Range Set Source = ActiveDocument For i = 1 to Source.Sections.Count Set Letter = Source.Sections(i).Range Letter.End=Letter.End-1 Set Target = Documents.Add Target.Range=Letter Target.SaveAs FileName:="Letter" & i Target.Close Next i If you want each file to be named based on one of the fields in the data source, here's a method that I have used that involves creating a separate catalog type mailmerge maindocument which creates a word document containing a table in each row of which would be your data from the database that you want to use as the filename. You first execute that mailmerge, then save that file and close it. Then execute the mailmerge that you want to create the separate files from and with the result of that on the screen, run a macro containing the following code and when the File open dialog appears, select the file containing the table created by the first mailmerge ' Throw Away Macro created by Doug Robbins ' Dim Source As Document, oblist As Document, DocName As Range, DocumentName As String Dim i As Long, doctext As Range, target As Document Set Source = ActiveDocument With Dialogs(wdDialogFileOpen) .Show End With Set oblist = ActiveDocument Counter = 1 For i = 1 To oblist.Tables(1).Rows.Count Set DocName = oblist.Tables(1).Cell(i, 1).Range DocName.End = DocName.End - 1 'Change the path in the following command to suit where you want to save the documents. DocumentName = "I:\WorkArea\Documentum\" & DocName.Text Set doctext = Source.Sections(i).Range doctext.End = doctext.End - 1 Set target = Documents.Add target.Range.FormattedText = doctext target.SaveAs FileName:=DocumentName target.Close Next i -- 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 "Al Christoph" wrote in message ... I have a data base that contains all the information need to produce church bulletins for the coming year. I have a word template that nicely merges everything together. However, this is not the final product for the pews. Others are involved. I need to send in the merged document, and they have requested that it come as an MS Word document. 1. How do "print" to a Word document? If I just cut and paste, the field associations remain. 2. Is there a command to output a range of records? Right now it only does the currently displayed record. I'm not sure that this is exactly on topic since its not a mail merge situation, but rather some other kind of use the data from Access in a Word document mess. (Working Sunday by Sunday and printing the bulletins myself this made sense and worked, but I'm not longer in the final production game.) Regards, Al |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Please give us REVEAL CODES like WORD PERFECT not reveal codes in. | Microsoft Word Help | |||
Making Word do something that Wordperfect can do | New Users | |||
Locking Two Words Together to Make a Proper Compound Noun in Word | Microsoft Word Help | |||
In Word, how can I see all files (*.*) in "save as"? | New Users | |||
WP Delay Code - Word Equiv | Microsoft Word Help |