![]() |
#11
|
|||
|
|||
![]()
pt,
That won't change the fact that the combobox list column limite is 2047 characters (or at least appears so) or help explain why you would want to put the value of a building block in a combobox column. What is your ultimate goal? If it is to insert building block content into a document then I think you are going about it in the wrong way. Consider: Note: Obviously I am not using your template, using AutoText (9) vice CustomAutoText, and my categories are "General" and "Signatures" Code:
Option Explicit Dim objTemplate As Template Private Sub UserForm_Initialize() With ComboBox1 .AddItem "General" .AddItem "Signatures" End With lbl_Exit: Exit Sub End Sub Private Sub ComboBox1_Change() Dim lngIndex As Long Dim oBB As BuildingBlock Dim oCat As Category 'Set objTemplate = Templates(Environ("APPDATA") & "\Microsoft\Word\STARTUP\ReportMacros.dotm") Set objTemplate = Templates(ThisDocument.AttachedTemplate.FullName) ComboBox2.Clear Set oCat = objTemplate.BuildingBlockTypes(9).Categories(ComboBox1) For lngIndex = 1 To oCat.BuildingBlocks.Count Set oBB = oCat.BuildingBlocks(lngIndex) With ComboBox2 .AddItem .List(.ListCount - 1, 0) = oBB.Name .List(.ListCount - 1, 1) = oBB.Type.Index .List(.ListCount - 1, 2) = oBB.Category.Name End With Next lngIndex ComboBox2.Text = ComboBox2.List(0) lbl_Exit: Exit Sub End Sub Private Sub CommandButton1_Click() objTemplate.BuildingBlockTypes(ComboBox2.Column(1)).Categories(ComboBox2.Column(2)).BuildingBlocks(ComboBox2.Column(0)).Insert Where:=Selection.Range, RichText:=True Hide lbl_Exit: Exit Sub End Sub |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Userform calls other userform, then populate worksheet | Lehoi | Excel Programming | 0 | 02-03-2016 02:58 PM |
VBA Code in a UserForm module to delete a Command Button which opens the userform | Simoninparis | Word VBA | 2 | 09-21-2014 03:50 AM |
![]() |
BoringDavid | Word VBA | 5 | 05-09-2014 09:08 AM |
Using Word autocorrect and autotext entries in outlook | dswapp | Outlook | 2 | 11-24-2010 10:18 AM |
Maintaining AUtotext Entries from an external table. | kelzud | Word Tables | 0 | 07-28-2009 01:31 PM |