Hello,
Thanks so much for that gmaxey it works perfect for one box, can't seem to get a second box to work says block if without end if
Not sure what i have done wrong, can you provide some insight?
Thanks again
This is the code i have been pra
Private Sub CommandButton1_Click()
Set ovars = ActiveDocument.Variables
Dim oRng As Word.Range
If CheckBox1.Value Then
Set oRng = ThisDocument.AttachedTemplate.BuildingBlockTypes(wdTypeAutoText). _
Categories("general").BuildingBlocks("electrical").Insert(ActiveDocument.Bookmarks("d").Range, True)
ActiveDocument.Bookmarks.Add "d", oRng
If CheckBox2.Value Then
Set oRng = ThisDocument.AttachedTemplate.BuildingBlockTypes(wdTypeAutoText). _
Categories("general").BuildingBlocks("4.2").Insert(ActiveDocument.Bookmarks("bmdemo").Range, True)
ActiveDocument.Bookmarks.Add "bmDemo", oRng
End If
Hide
Me.Hide
ovars("customername").Value = Me.TextBox1.Value
ovars("line1").Value = Me.TextBox2.Value
ovars("line2").Value = Me.TextBox3.Value
ovars("line3").Value = Me.TextBox4.Value
ActiveDocument.Fields.Update
'Clear the variable
Set ovars = Nothing
'Unload the form
Unload Me
End Sub