Article ID: 163192
Article Last Modified on 1/24/2007
Sub StringTooLongError()
Dim sMyVar As String
sMyVar = String(256, "x")
ActiveDocument.FormFields(1).Result = sMyVar
End Sub
Sub WorkAround255Limit()
' Set Text1 form field to a unique string.
ActiveDocument.FormFields("text1").Result = "****"
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect
End If
Selection.GoTo What:=wdGoToBookmark, Name:="Text1"
Selection.Collapse
Selection.MoveRight wdCharacter, 1
Selection.TypeText (String(256, "W"))
Selection.GoTo what:=wdGoToBookmark, Name:="Text1"
' Remove unique characters from Text1 form field.
With Selection.Find
.Execute findtext:="*", replacewith:="", replace:=wdReplaceAll
End With
ActiveDocument.Protect Password:="", NoReset:=True, Type:= _
wdAllowOnlyFormFields
End Sub
163435 VBA: Programming Resources for Visual Basic for Applications
305326 OFFXP: Programming resources for Visual Basic for Applications
226118 OFF2000: Programming resources for Visual Basic for Applications
Additional query words: wordcon kbcode kbmacro vba wd2003 wd97 kbnoOfficeAlertID wd2007
Keywords: kbcode kbmacro kbprogramming kbprb kbdtacode KB163192