When adding a new buildingblock entry into the template.BuildingBlockEntries via the .Add method, I get "Object doesn't support this property or method". Now, I believe that I have done it correctly, but I also don't know if what I am doing wrong is with the Add method, or if something I am inserting is the wrong type. I was getting type mismatches, but I believe that they're resolved. I've scoured every link on the first 3 pages of google on every single possible way to search this issue, yet not a single person has had this issue. Any help that points even in the general direction of the solution would be greatly appreciated.
Code: Select all
Selection.Range.Text = ListBoxValue.List(i)
If ListBoxInsertOptions.List(i) = "0" Then
Debug.Print DocBlockTypes(1).Name
Set entry = temp.BuildingBlockEntries.Add(Name:=ListBoxName.List(i), _
Type:=DocBlockTypes(ListBoxType.List(i)), Category:=ListBoxCategory.List(i), Range:=Selection.Range, _
Description:=ListBoxDescription.List(i), insertoptions:=wdInsertContent)
ElseIf ListBoxInsertOptions.List(i) = "1" Then
Set entry = temp.BuildingBlockEntries.Add(Name:=ListBoxName.List(i), _
Type:=DocBlockTypes(ListBoxType.List(i)), Category:=ListBoxCategory.List(i), Range:=Selection.Range, _
Description:=ListBoxDescription.List(i), insertoptions:=wdInsertParagraph)
ElseIf ListBoxInsertOptions.List(i) = "2" Then
Set entry = temp.BuildingBlockEntries.Add(Name:=ListBoxName.List(i), _
Type:=DocBlockTypes(ListBoxType.List(i)), Category:=ListBoxCategory.List(i), Range:=Selection.Range, _
Description:=ListBoxDescription.List(i), insertoptions:=wdInsertPage)
End If
I've hacked a way around inserting the correct insertoptions based on the value of it within the listbox, so please ignore the very clearly poor choice of code for the elseif statements. They were quick placeholders until I got the problem figured out and then I would fix them, I swear!