none
VBA Error 5941. The Requested member of this collection does not exist. RRS feed

  • Question

  • Word 2016.  I have created a letterhead template.  When I create a new document from the template I have a macro that I can play that will pull up a user form.  The user form has various radio buttons on it.  Depending on the choice, it will insert an autotext/building block entry at a bookmark inside the header.  I keep getting the error on the following text and it begins at "ThisDocument.AttachedTemplate. . ."

    If Optionladt.Value = True Then ThisDocument.AttachedTemplate _
            .BuildingBlockEntries("\ladt") _
            .Insert _
            Where:=ActiveDocument.Bookmarks("OffAddressBlock").Range, _
            RichText:=True  

    I have used the "      Templates.LoadBuildingBlocks " line but it still doesn't work.  Any ideas?  PLEASE??  I should also mention that there is also a pick list on the user form that pulls data from another document.  Not sure if that causes any problems.   I had this save macro in Word 2010 in the Word\Startup folder and it worked great.  I cannot put it in the StartUp Folder (I get a different error) and I cannot create new documents from it.   Any suggestions?

    Thursday, April 4, 2019 1:14 AM

All replies

  • Are you sure that the bookmark exists?  You will get that error if it does not.

    Doug Robbins - Word MVP dougrobbinsmvp@gmail.com

    Thursday, April 4, 2019 10:07 AM
  • Great thought.  I did double and triple check that the bookmark exists.  The bookmark is in a header though. . .in case that would make a difference.

    Thursday, April 4, 2019 2:11 PM