Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-23-2024, 05:32 AM
MulaMuster MulaMuster is offline Listbox with available Building Blocks to choose from Windows 11 Listbox with available Building Blocks to choose from Office 2021
Novice
Listbox with available Building Blocks to choose from
 
Join Date: May 2024
Posts: 1
MulaMuster is on a distinguished road
Question Listbox with available Building Blocks to choose from

Hi there, I'm struggeling with the following.



I have a Word form with a listbox. I fill this listbox with the available Building Blocks in the template. I wan't to multichoose the items in the listbox and select insert so selected Building Blocks are added to the document. The template with the building blocks and the form is stored on SharePoint using Content Types so i can select this template to start from Sharepoint. It works but not as i want it to work and can't figure it out.

Private Sub cmdList_Click()
Dim objTemplate As Template
Dim objBB As BuildingBlock

Set objTemplate = ThisDocument.AttachedTemplate

With lstFoundBBs
For i = 0 To .ListCount - 1
If .Selected(i) Then
Set objBB = objTemplate.BuildingBlockEntries(lstFoundBBs.Value )
objBB.Insert Selection.Range
End If
Next i
End With
Exit For

End Sub

Keeping error on objTemplate.BuildingBlockEntries(lstFoundBBs.Value ). If I choose objTemplate.BuildingBlockEntries(1) it takes the first Building Block so I need to translate number 1 from the listbox.


I need this to work for all categories.


As alternative I tried the follwing:

Set oBB = Application.Templates(sTempName).BuildingBlockType s(wdTypeAutoText).Categories.Item("MMW").BuildingB locks(sBBName)

I need the Categories.Item("MMW") to be dynamic and working for all categories.

Any help on this will be appreciated.

Thanks.
Reply With Quote
 

Tags
building block, listbox, word vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
Building blocks NorbertM Word 5 11-22-2019 11:25 AM
VBA Word - Building Block (AutoText) - Array - Replace Text with Specific Building Blocks jc491 Word VBA 7 01-03-2016 10:34 PM
Sharing Building Blocks dricciuti Word 0 11-03-2013 03:40 PM
Building blocks show correctly in dropdown, but wrong building block populates in doc wordgirl123 Word 0 10-03-2013 08:30 AM
Building Blocks - WHY??? namedujour Word 5 05-03-2011 01:37 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:17 AM.


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