• Basicbasic Command For Building Blocks?

    Author
    Topic
    #472206

    When recording a macro that involves Building blocks (a feature introduced in Word 2007), the macro comes out with:

    WordBasic.CreateCommonFieldBlockFromSel Description:=””

    1) Why is a WordBasic command being used with such a new feature.

    2) Can’t a title be added to it?

    Viewing 0 reply threads
    Author
    Replies
    • #1248748

      1) Why is a WordBasic command being used with such a new feature.

      Good question!

      The macro recorder is imperfect. You probably want to use the built-in VBA methods if you can. For example (based on code sample in the help file):

      Code:
      Dim myNewBuildingBlock as Word.BuildingBlock, _
          myTemplate as Word.Template
      
      Set myTemplate = NormalTemplate ' to add to Normal.dotm, or the template of your choice
      
      Set myNewBuildingBlock = _
          myTemplate.BuildingBlockEntries.Add(Name:="New Building Block Entry", _
          Type:=wdTypeWatermarks, Category:="General", Range:=Selection.Range)
    Viewing 0 reply threads
    Reply To: Basicbasic Command For Building Blocks?

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: