
Text from vba text box (>2000 characters) to a Word bookmard
I have an access memo field loaded into a
Visual Basic text box. The text
box contain about 2100 characters so I am trying to move them in 255 blocks.
I have tried bookmark points and formfields, inserting before and inserting
after, but the results are always scrambled. The contents of each 255
character block is correct but the blocks are out of order. Here is the
section of code I use:
If Len(frmTab13.Text1.Text) > 255 Then
ActiveDocument.Unprotect
Dim strLen As Long
lStart = 1
' strLen = 0
Do While lStart < Len(frmTab13.Text1.Text)
xStr = ""
xStr = Mid$(frmTab13.Text1.Text, lStart, 255)
Selection.GoTo what:=wdGoToBookmark, Name:="Minutes"
' Selection.InsertAfter xStr
oWD.FormFields("Minutes").Result = xStr
lStart = lStart + 255
Loop
Else
oWD.FormFields("Minutes").Result = frmTab13.Text1.Text = ""
End If
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
Thanks in advance for any help, Vik