Re: FormFields(1).Result - maximum 255 characters by Russ
Russ
Fri Jun 29 20:11:32 CDT 2007
Fred,
Using =rand(22,22)<ENTER>, I generated over 17,000 characters that I was
able to create an AutoText entry for and AutoText insert into a new blank
document.
Look in VBA help for creating, inserting, deleting AutoText entries.
The code is similar to what David used for AutoCorrect since they are close
cousins code-wise.
> Hi David,
>
> thanks for the idea but I can't get it to autocorrect on its own. For it to
> work I need to manually go into the document and enter a space after the
> autocorrect field name ("Half1").
> Is there someway of programmatically forcing word to apply the
> autocorrection.?
>
> Fred
>
>
> "David Sisson" <Tinbendr@gmail.com> wrote in message
> news:1182950629.881056.237600@k29g2000hsd.googlegroups.com...
>> Hey Fred,
>>
>> I found this workaround. It's not pretty and may require manual
>> intervention, but it gets more than 255 characters in the formfield.
>> It allows you to edit the field after the macro runs, too.
>>
>> Sub Insert255Plus
>> Dim MyString As String
>> Dim HalfLength As Integer
>> Dim Half1 As String
>> Dim Half2 As String
>>
>> HalfLength = Len(MyString) / 2
>> Half1 = Left(MyString, HalfLength)
>> Half2 = Right(MyString, Len(MyString) - HalfLength)
>>
>> AutoCorrect.Entries.Add Name:="Half1", Value:=Half1
>> AutoCorrect.Entries.Add Name:="Half2", Value:=Half2
>>
>> ActiveDocument.FormFields(1).Result = "Half1 Half2"
>>
>> End Sub
>>
>> The catch is that the autocorrect entry can't be more than 255
>> characters. That's why I split the string in two lengths
>>
>> Hope this helps,
>> David
>>
>
>
--
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID