
Originally Posted by
Chas Kenyon
There is a macro for inserting a building block at a range on my. It is Situation #3. Before getting into the series of IF's looking for the building block, you would want to collapse the range oRange.Collapse possibly with a direction.
This is based on Graham Mayor's macro to insert a building block regardless of which template holds the building block.
I had a go at collapsing the range, but still had the same outcome. I've probably got the syntax wrong?
Dim updateObjective As Word.Range
Set updateObjective = ActiveDocument.Bookmarks("bmObjectives").Range
updateObjective.Collapse Direction:=wdCollapseEnd
If cbObjectivesFamilyIncome.Value Then
Set updateObjective = ThisDocument.AttachedTemplate.BuildingBlockTypes(wdTypeQuickParts). _
Categories("SL-Objectives").BuildingBlocks("FamilyIncome").Insert(ActiveDocument.Bookmarks("bmObjectives").Range, True)
ActiveDocument.Bookmarks.Add "bmObjectives", updateObjective
End If
If cbObjectivesBuyHouse.Value Then
Set updateObjective = ThisDocument.AttachedTemplate.BuildingBlockTypes(wdTypeQuickParts). _
Categories("SL-Objectives").BuildingBlocks("payOffMortgage").Insert(ActiveDocument.Bookmarks("bmObjectives").Range, True)
ActiveDocument.Bookmarks.Add "bmObjectives", updateObjective
End If