A family of Microsoft word processing software products for creating web, email, and print documents.
It's an old and very annoying bug in VBA. See here for a workaround.
Jay Freedman MS Word MVP
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
The Access field is a memo. The Word form field is limited to 1000 characters (hence the need for the memo field in the Access database). Interestingly enough, as long as I only insert a max of 255 characters I get no error. Even more stunning is that there is no error in processing the document to retrieve data filled in by a user, i.e., if the user enters 472 characters (for example) then all of that can be pull from the formfield.Result and properly placed in the database memo field. The problem occurs if I attempt to regenerate the document with more than 255 characters of data in the memo field.
Any help would be most appreciated!!! James
PS - this may not be posted in the proper place ... but it seemed to be the best fit based on the selectable topics.
A family of Microsoft word processing software products for creating web, email, and print documents.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Answer accepted by question author
Use
Dim docprot As Boolean
With ActiveDocument
If .ProtectionType <> wdNoProtection Then
blnprot = True
.Unprotect
Else
blnprot = False
End If
.Bookmarks("Text1").Range.Fields(1).Result.Text = Str1
If blnprot = True Then
.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End If
End With
-- Hope this helps.
Doug Robbins - Word MVP,
dkr[atsymbol]mvps[dot]org
Posted via the Community Bridge
"threni" wrote in message news:*** Email address is removed for privacy ***...
May I ask what to do when this solution causes another error to the effect that the document is already unprotected?
Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org
May I ask what to do when this solution causes another error to the effect that the document is already unprotected?
Woooooow, many thanks to both of you, I thought I would become crazy with this odd issue.
Had the same issue with word automation though a C# windows application.
This does not work:
newDoc.FormFields.get_Item(ref field).Result = strValue;
This works:
newDoc.FormFields.get_Item(ref field).Range.Fields[1].Result.Text = strValue;
Thanks !!!
Thank you Jay. I was just coming back here to put a note that I had found a solution from a different source. I'm not sure why I didn't find it when doing my initial search (which prompted me to post this question). The link you provided was much more succinct and informative and would have saved me quite a bit of time! Many thanks again... James