Field width limit in Word

D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

Yes and No. You cannot simply use the .Result property of a formfield to
insert more than 255 characters into a formfield. However, you can get
around that as follows:

' Macro created 05/09/98 by Doug Robbins to insert long string into
FormField
'
FillText = "Your long string"
FirstBit = Left(FillText, 255)
If Len(FillText) > 255 Then
SecondBit = Mid(FillText, 256, Len(FillText) - 255)
ActiveDocument.FormFields("Text1").Result = FirstBit
ActiveDocument.Unprotect
ActiveDocument.FormFields("Text1").Range.InsertAfter SecondBit
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
Else
ActiveDocument.FormFields("Text1").Result = FillText
End If


The excess is however not inserted into the formfield, but after it.
--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top