Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21358

Conditional Mail Merge

$
0
0
I am trying to create a page break if a certain field Changes. But i cannot get this to work. Why? This is what i did and word is hanging.

This is done in VB6 calling aord with automation.


myword.ActiveDocument.MailMerge.Fields.Add myword.Selection.Range, FieldName
myword.Selection.CreateAutoTextEntry "PBF", myword.Selection.WholeStory
myword.ActiveDocument.Content.Delete
'myword.Selection.InsertBreak Type:=wdPageBreak
'myword.Selection.CreateAutoTextEntry "PB", myword.Selection.WholeStory
'myword.ActiveDocument.Content.Delete

myword.ActiveDocument.MailMerge.Fields.AddIf myword.Selection.Range, FieldName, wdMergeIfNotEqual, "PgeBreakV", "", "Ctrl+Enter"
myword.ActiveDocument.MailMerge.Fields.AddSet myword.Selection.Range, "PgeBreakV", , "PBF"

Viewing all articles
Browse latest Browse all 21358

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>