Merge field using an object?

G

Greg Strong

Using MS Word 2002 can you do a mail merge from an Access 2002 database
where the merge field is an object containing another Word document?

I'm trying to create a second page which will depend upon the query
output. I've tried and the word document is NOT used as the subsequent
page. So either I'm doing something wrong, or it can NOT be done. Please
let me know. Thanks!

Regards,


Greg Strong
 
G

Graham Mayor

Could you use a conditional field eg
{IF {Mergefield fieldname} = "condition" "{Includetext
"c:\\path\\docname.doc"}"}

--
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
Graham Mayor - Word MVP
E-mail (e-mail address removed)
Web site www.gmayor.com
Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
 
P

Peter Jamieson

No, Word mailmerge cannot extract the content of an Access object field in
that way. You have to export the contained document to the file system first
then use an INCLUDETEXT.
 
G

Greg Strong

Could you use a conditional field eg
{IF {Mergefield fieldname} = "condition" "{Includetext
"c:\\path\\docname.doc"}"}

After going through the learning curve I got it to work. It will save a
lot of work. Now I'll have to learn some other utility software to
eliminate more work and automate the process of splitting the merged
document which includes many separate documents into separate saved
documents with file names included in a comment. If you have any helpful
hints here it would be of great help.

Thanks!

Regards,


Greg Strong
 
G

Greg Strong

There are several merge related tutorials on my web site, but for the
immediate issue see http://www.gmayor.com/individual_merge_letters.htm

I will have to look into the macro, but I have other reasons learn the
separate utility, PowerPro, because it can be used for other programs.

I have ran into another glitch with the PowerPro script. I was using the
key commands to do a lot of the work and I can't go to the 4th page of a
13 page document broken down into different sections. When I use the F5
(i.e. Go To) page 4 I end up at the end of the document because there
each individual document is 3 pages long. I could have sworn it was
working. Maybe in my testing the keys changed a Word setting. I don't
know. Anyhow!!!

Is there any setting where I can get Word to go to the 4th page with the
F5 key?

TIA!!!

Regards,


Greg Strong
 
G

Graham Mayor

Goto works with Word 2003, but you can address a specific page by
section/page eg s2p3 for Page three of the second letter.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
Graham Mayor - Word MVP
E-mail (e-mail address removed)
Web site www.gmayor.com
Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
 
G

Greg Strong

Goto works with Word 2003, but you can address a specific page by
section/page eg s2p3 for Page three of the second letter.

Well this helpful hint doesn't help me a bit with Word 2002. I'll have
to think of a work around.

Regards,


Greg Strong
 
G

Graham Mayor

Have you tried addressing the required page by section and page in Word
2002? This should work for all versions.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
Graham Mayor - Word MVP
E-mail (e-mail address removed)
Web site www.gmayor.com
Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
 
G

Greg Strong

Goto works with Word 2003, but you can address a specific page by
section/page eg s2p3 for Page three of the second letter.

Well Word 2002 should go to page 4 of the 13 page document. I have a
multi-boot system and restored a partition with Ghost. The restored
partition with Word 2002 did work the way I thought it should. Simply
stated something messed up my system.

Regards,


Greg Strong
 
G

Greg Strong

Have you tried addressing the required page by section and page in Word
2002?

Not until just know. It works like you stated with s2p1, or what ever I
need.
This should work for all versions.

Yes.

What really is STRANGE is I restored a bootable partition from an image.
When I did the merge in the admin account I set up there were only 12
pages on the test AND all I had to do was F5 with only the number 4 to
go to the 4th page. When I went to the limited account and did the
merge there were 13 pages AND with F5 I had to enter s2p1 to go to the
4th page. In the limited account if I entered 4 after the F5, I would
go to the last page.

So something is a little fickle with Word between admin and limited
users. Don't know what it is, but it definitely exists.

Regards,


Greg Strong
 
G

Greg Strong

There are several merge related tutorials on my web site, but for the
immediate issue see http://www.gmayor.com/individual_merge_letters.htm

Between your link above and the additional two below:
http://www.cpearson.com/excel/clipboar.htm
http://support.microsoft.com/?kbid=212730

I was able to pull the data off the merged document, copy it to the
clipboard, and use for the file name. The file name provides a direct
link to the data in the Access database. I had to use the 'DataObject'
in order to do this which reguired a reference to the Microsoft Forms
2.0 object library. The last link above tell you how to set up the
reference.

Works like a charm. THANKS!!!

,----- [ Modified splitter ]
| Sub Splitter()
| ' splitter Macro
| ' Macro created 16-08-98 by Doug Robbins to save each letter created by a
| ' mailmerge as a separate file.
| ' With minor modifications by Graham Mayor 10-02-03
| ' Modifications by GW on 1-7-04
|
| Dim mask As String
|
| Dim MyDataObj As New DataObject
| Selection.EndKey Unit:=wdStory
| Letters = Selection.Information(wdActiveEndSectionNumber)
| Selection.HomeKey Unit:=wdStory
| Counter = 1
| While Counter < Letters
| 'DocName = "x:\Temp\Workgroup\" & Format(Date, mask) & " " & LTrim$(Str$(Counter))
| ActiveDocument.Sections.First.Range.Cut
| Documents.Add
| Selection.Paste
|
| Selection.EndKey Unit:=wdStory
| Selection.MoveLeft Unit:=wdCharacter, Count:=2
| Selection.Delete Unit:=wdCharacter, Count:=1
| Selection.Delete Unit:=wdCharacter, Count:=1
|
| Selection.GoTo What:=wdGoToSection, Which:=wdGoToFirst, Count:=1, Name:=""
| Selection.GoTo What:=wdGoToPage, Which:=wdGoToFirst, Count:=2, Name:=""
| Selection.Find.ClearFormatting
| With Selection.Find
| .Text = ""
| .Replacement.Text = ""
| .Forward = True
| .Wrap = wdFindContinue
| .Format = False
| .MatchCase = False
| .MatchWholeWord = False
| .MatchWildcards = False
| .MatchSoundsLike = False
| .MatchAllWordForms = False
| End With
| Selection.MoveLeft Unit:=wdCharacter, Count:=2
| Selection.HomeKey Unit:=wdLine, Extend:=wdExtend
| Selection.Cut
| MyDataObj.GetFromClipboard
| mask = MyDataObj.GetText()
| DocName = "x:\Temp\Workgroup\" & mask
| ActiveDocument.SaveAs FileName:=DocName, FileFormat:=wdFormatDocument
| ActiveWindow.Close
| Counter = Counter + 1
| Wend
|
| End Sub
`-----


Regards,


Greg Strong
 

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