PDA

View Full Version : [SOLVED:] VBA insert Building Block on new page



wannabeguru
08-03-2015, 02:56 PM
Hi gurus,

I'm currently using the below code to insert Building Blocks based on a user's selections in a UserForm. However I can't figure out how to adjust the below code to insert each Building Block on a new page.

Any help would be much appreciated! Thanks!


Set rg = ActiveDocument.Range
rg.Collapse wdCollapseEnd
If CBMerchantAgreement.Value = True Then
Set rg = tmpl.BuildingBlockEntries("MERCHANT AGREEMENT").Insert( _
where:=rg, RichText:=True)
With rg.Font
.Name = "Times New Roman"
End With
End If

gmayor
08-03-2015, 09:45 PM
The simplest solution is to add the page break to your building block, but if you want to do it in code
Set rg = ActiveDocument.Range
rg.Collapse wdCollapseEnd
rg.InsertBreak wdPageBreak
rg.Collapse wdCollapseEnd

wannabeguru
08-04-2015, 12:13 PM
Thanks gmayor. Adding page breaks to my building blocks did the trick. Appreciate the help!