View Single Post
 
Old 08-19-2014, 07:21 AM
Smallweed Smallweed is offline Windows 7 64bit Office 2010 32bit
Novice
 
Join Date: Aug 2013
Posts: 13
Smallweed is on a distinguished road
Default

I've managed to fix it - though no idea why this has worked! The code actually was as follows, typing a couple of hard returns and doing some other stuff before inserting the autotext:

With Selection
.EndKey Unit:=wdStory
.TypeText vbCr
.TypeText vbCr
End With
other code
ActiveDocument.AttachedTemplate.AutoTextEntries("m yStandardText") _
.Insert Where:=Selection.Range, RichText:=True

I tried commenting out the two .TypeText lines and it now works fine. I think we can survive without them: they were just there to ensure a gap before the autotext entry but there's usually a stray hard return or two at the bottom of the document anyway.

Makes no sense to me why this has fixed the problem but there we go. I better update all the other templates too.

By the way, there definitely isn't a space between the "m" and the "y" in my autotext name above as I type this but one keeps appearing when I post. Maybe it's because I'm using Firefox?
Reply With Quote