Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #10  
Old 02-12-2016, 08:08 PM
ptmuldoon ptmuldoon is offline UserForm of Autotext Entries Windows 7 64bit UserForm of Autotext Entries Office 2013
Advanced Beginner
UserForm of Autotext Entries
 
Join Date: Sep 2014
Posts: 93
ptmuldoon is on a distinguished road
Default

In continuing to learn, I believe I have learned the underlying cause is that VBA will truncate a string down to 255 characters.

Greg, I found an old post of yours here helping with a similar issue and the solution appears to insert the buildingblock into a temp file and then set a string variable to that selection. That old post is here:

http://www.vbaexpress.com/forum/arch...p/t-44367.html

I think I got it working with this, and just need to change the hardcoded building block name to a variable.

Code:
Sub BuildingBlockMsgBox()
Dim oTmp As Template
Dim sPath As String
Dim oScratchPad As Word.Document
Dim oRng As Word.Range

sPath = Environ("APPDATA") & "\Microsoft\Word\STARTUP\ReportMacros.dotm"
Set oTmp = Templates(sPath)

'oTmp.BuildingBlockEntries("Foreign AR").Insert Selection.Range
Set oScratchPad = Documents.Add(, , , False)
Set oRng = oTmp.BuildingBlockEntries("Foreign AR").Insert(Where:=oScratchPad.Selection.Range, RichText:=True)
MsgBox oRng
oScratchPad.Close wdDoNotSaveChanges
Set oScratchPad = Nothing

End Sub
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 12:44 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