#1
|
|||
|
|||
VBA code for loading autotext using userform and commandbutton
I would be preparing a 'abc template' . The autotext entries would be stored in quick parts>gallery:autotext>category: general>save in:abc template. The template would then be double clicked to open a word document and document will be created by using autotext entries. I want a VBA code prepared such that when I click a button on the quick access toolbar, a userform/ listbox (named 'select_test_method') with a command button ((named 'Enter') opens up with the list of autotext libraries. When I select any autotext entry, the corresponding text gets loaded on the word document. word document.
This template will be shared with others via email. |
#2
|
|||
|
|||
The Quick Access Toolbar cannot be shared, so you'll need to add the button to the ribbon by adding some Ribbon UI xml to the template. You'll find some info about doing this on Greg Maxey's website: Customize the Office Ribbon (It doesn't take rocket science)
However, as there are built-in galleries to display the Quick Parts I wouldn't bother trying to re-invent the wheel by writing code to display the entries and add them to the document. Add your texts to the Custom Autotext gallery and then add that control to the ribbon. This has the advantage that entries in the Custom AutoText gallery aren't visible in the standard gallery on the ribbon. To add the gallery to the ribbon you can use xml like this: Code:
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"> <ribbon > <tabs > <tab id="tabABCTemplate" insertAfterMso="TabHome" label="Your Text Here"> <group id="grpABCTemplate" label="Your Text Here" centerVertically="true"> <gallery idMso="CustomAutoTextGallery" label="Your Text Here" size="large" /> </group > </tab > </tabs > </ribbon > </customUI > Last edited by Italophile; 12-17-2023 at 04:27 AM. |
#3
|
|||
|
|||
The Quick Access Toolbar modifications CAN be shared and can be stored in a document or global template.
Modifying the Quick Access Toolbar (QAT) in Microsoft Word For code to insert Building Blocks, see:
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Userform selectbox to insert autotext | aee74 | Word VBA | 8 | 02-10-2019 03:39 AM |
Recording code to create Autotext entries | emblackett | Word VBA | 2 | 09-25-2017 02:00 AM |
Creating a (shared!) file with CommandButton placing AutoText into the document | thmsrox | Word VBA | 5 | 07-07-2016 05:04 AM |
UserForm of Autotext Entries | ptmuldoon | Word VBA | 11 | 02-13-2016 09:36 AM |
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 |