View Single Post
 
Old 11-11-2016, 09:10 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2013
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,158
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

It sounds like the position of the bookmark is locked in some way so that the BB cannot be inserted there. Perhaps if you offset the insertion point by one character then there wouldn't be a need to keep resetting the bookmark location
Code:
  Dim objTemplate As Template
  Dim objBB5 As BuildingBlock
  Dim BBName As String 'Building Block String
  Dim BM1 As String 'Bookmark String
  Dim Rng5 As Range
   
  BM1 = "Bookmark1"
  Set objTemplate = ActiveDocument.AttachedTemplate
  Set Rng5 = ActiveDocument.Bookmarks(BM1).Range
  Rng5.InsertAfter "  "  'two spaces
  Rng5.Start = Rng5.End + 1   'collapse the range to between those spaces
  BBName = "One"
  Set objBB5 = objTemplate.BuildingBlockTypes(wdTypeAutoText).Categories("General").BuildingBlocks(BBName)
  objBB5.Insert Rng5, True  'INSERT Building BLOCK
An alternative is the redo the BuildingBlock to include a space before whatever comes first
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote