Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-14-2018, 06:28 PM
kateabode kateabode is offline VBA temperamentally not finding building block template Windows 7 64bit VBA temperamentally not finding building block template Office 2016
Novice
VBA temperamentally not finding building block template
 
Join Date: Sep 2018
Posts: 16
kateabode is on a distinguished road
Default VBA temperamentally not finding building block template

I'm inserting a TOC from the Building Blocks Templates. Sometimes it works, sometimes it doesn't. If I close Word and open it, (which runs macros upon opening) it comes up with the error 5941 requested member not found.



However if I stop the macro and go into word, and click on the Table of Contents drop down, not selecting anything, and then go back into VBA and run it, then it works! It's very frustrating and I don't know how to fix this.

Any help is greatly appreciated.

Code:
Application.Templates( _
        "C:\Users\reception.AIRDG\AppData\Roaming\Microsoft\Document Building Blocks\1033\16\Built-In Building Blocks.dotx" _
        ).BuildingBlockEntries("Automatic Table 2").Insert Where:=Selection.Range _
        , RichText:=True
Reply With Quote
  #2  
Old 10-14-2018, 07:56 PM
gmaxey gmaxey is offline VBA temperamentally not finding building block template Windows 7 32bit VBA temperamentally not finding building block template Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,428
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

Try adding this before your existing troublesome line of code:

Templates.LoadBuildingBlocks
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #3  
Old 10-14-2018, 08:35 PM
kateabode kateabode is offline VBA temperamentally not finding building block template Windows 7 64bit VBA temperamentally not finding building block template Office 2016
Novice
VBA temperamentally not finding building block template
 
Join Date: Sep 2018
Posts: 16
kateabode is on a distinguished road
Default

Quote:
Originally Posted by gmaxey View Post
Try adding this before your existing troublesome line of code:

Templates.LoadBuildingBlocks

Thank you so much! Worked a treat!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA temperamentally not finding building block template VBA Code to Access Building Block Template in Word 2013 Startup folder rdross51 Word VBA 2 06-01-2016 07:05 PM
VBA Word - Building Block (AutoText) - Array - Replace Text with Specific Building Blocks jc491 Word VBA 7 01-03-2016 10:34 PM
VBA temperamentally not finding building block template How to share building block macros? rdross51 Word VBA 7 03-12-2015 08:59 AM
VBA temperamentally not finding building block template Custom Building Block File Locations ptmuldoon Word 5 01-03-2015 08:45 AM
Building blocks show correctly in dropdown, but wrong building block populates in doc wordgirl123 Word 0 10-03-2013 08:30 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:53 AM.


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