H
Hilary
Hi.
I have a Word doc with a form field. The form field is
populated with a list of strings.
Here is the problem. When the doc is created in Word 2000
and run in either Word 2000 or 2003, the form field
populates correctly. When the doc is created in Word 2003
and run in either Word 2000 or 2003, after the routine is
called more than twice, the form field loses its name and
the text is populated out of order.
Here is the code that is used in the Word VBA program and
is very similar to the one used in the VB executable. This
works using Word 2003 VBA, no matter what version the
document was created in.
Sub UpdateBookmark(BookmarkToUpdate As String, TextToUse
As String)
If ActiveDocument.FormFields(BookmarkToUpdate).Result
= "" Then
ActiveDocument.FormFields(BookmarkToUpdate).Result
= TextToUse
Else
strOldData = ActiveDocument.FormFields
(BookmarkToUpdate).Result
ActiveDocument.Bookmarks(BookmarkToUpdate).Select
Selection.InsertBefore strOldData
ActiveDocument.FormFields(BookmarkToUpdate).Result
= TextToUse
End If
End Sub
Private Sub CommandButton1_Click()
For x = 1 To 10
UpdateBookmark "Text1", CStr(x) & Chr(11)
Next
End Sub
Any advice? I know the obvious is to switch to 2000, but
we can't do that.
Thanks!
Hilary
I have a Word doc with a form field. The form field is
populated with a list of strings.
Here is the problem. When the doc is created in Word 2000
and run in either Word 2000 or 2003, the form field
populates correctly. When the doc is created in Word 2003
and run in either Word 2000 or 2003, after the routine is
called more than twice, the form field loses its name and
the text is populated out of order.
Here is the code that is used in the Word VBA program and
is very similar to the one used in the VB executable. This
works using Word 2003 VBA, no matter what version the
document was created in.
Sub UpdateBookmark(BookmarkToUpdate As String, TextToUse
As String)
If ActiveDocument.FormFields(BookmarkToUpdate).Result
= "" Then
ActiveDocument.FormFields(BookmarkToUpdate).Result
= TextToUse
Else
strOldData = ActiveDocument.FormFields
(BookmarkToUpdate).Result
ActiveDocument.Bookmarks(BookmarkToUpdate).Select
Selection.InsertBefore strOldData
ActiveDocument.FormFields(BookmarkToUpdate).Result
= TextToUse
End If
End Sub
Private Sub CommandButton1_Click()
For x = 1 To 10
UpdateBookmark "Text1", CStr(x) & Chr(11)
Next
End Sub
Any advice? I know the obvious is to switch to 2000, but
we can't do that.
Thanks!
Hilary