J
Jules
Hi, I still cannot get this to insert the customautotext "Receipt" at all! Any ideas on a solution please.
Sub ATeInsert1()
Dim intReceipt As Integer
Dim i As Integer
Dim objTemplate As Template
Dim objBB As BuildingBlock
intReceipt = InputBox("How many Receipts do you need?", "Number of Receipts")
Do While i < intReceipt
' Set the template to store the building block
Set objTemplate = ActiveDocument.AttachedTemplate
' Access the building block through the type and category
Set objBB = objTemplate.BuildingBlockTypes(wdTypeCustomAutoText).Categories("Receipts").BuildingBlocks("Receipt")
' Insert the building block into the document replacing any selected text.
objBB.Insert Selection.Range
i = i + 1
Loop
End Sub
Sub ATeInsert1()
Dim intReceipt As Integer
Dim i As Integer
Dim objTemplate As Template
Dim objBB As BuildingBlock
intReceipt = InputBox("How many Receipts do you need?", "Number of Receipts")
Do While i < intReceipt
' Set the template to store the building block
Set objTemplate = ActiveDocument.AttachedTemplate
' Access the building block through the type and category
Set objBB = objTemplate.BuildingBlockTypes(wdTypeCustomAutoText).Categories("Receipts").BuildingBlocks("Receipt")
' Insert the building block into the document replacing any selected text.
objBB.Insert Selection.Range
i = i + 1
Loop
End Sub