Results 1 to 16 of 16

Thread: Problems with my Building Block Template

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #12
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,411
    Location
    Sarah,

    I just recorded a macro to insert a Normal.dotm building block in a plain text CC. Then wrote a custom macro to do the same thing:

    Sub Macro1()
      Application.Templates("D:\My Documents\Word\Templates\Normal.dotm"). _
      BuildingBlockEntries("Sincerely yours,").Insert Where:=Selection.Range, _
      RichText:=True
    End Sub
    
    Sub ScratchMacro()
        ' A basic Word macro coded by Greg Maxey
        Dim oCC As ContentControl
        Dim oTmp As Template
        For Each oTmp In Templates
             If UCase(oTmp.Name) = "NORMAL.DOTM" Then
                 Exit For
             End If
        Next oTmp
        Set oCC = ActiveDocument.SelectContentControlsByTitle("Tests").Item(1)
        oTmp.BuildingBlockEntries("Sincerely yours,").Insert Where:=oCC.Range, RichText:=True
        lbl_Exit:
        Exit Sub
    End Sub
    which I think is similar to what you are doing. The only way to get that error on that line that I see is a misnamed building block. If you want to wrap your template and file into a zip file and send it to me, you can and I will take a look. Just use the Feedback link on my website.

    Best Regards,
    Greg Maxey

    Saru mo ki kara ochiru (literally: Monkey even tree from fall). ~ Japanese Proverb
    Last edited by Aussiebear; 04-10-2025 at 07:16 PM.
    Greg

    Visit my website: http://gregmaxey.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •