Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 02-13-2016, 07:02 AM
gmaxey gmaxey is offline UserForm of Autotext Entries Windows 7 32bit UserForm of Autotext Entries Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

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
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



Similar Threads
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
UserForm of Autotext Entries Is it possible to take an input from a UserForm in one document to a UserForm in a do 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

Other Forums: Access Forums

All times are GMT -7. The time now is 11:23 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft