Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2007

Tip: Looking for answers? Try searching our database.

Why "String too long" (error 4609)?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peter J. Veger - 29 Mar 2007 11:40 GMT
Context: WinXP pro, Office 2003
Busy filling a Word form from an Outlook VbaProject module.
The error occurs when assigning a 300-byte string value to a Text Form Field
with a declared max length of 400

Extract from code:

 Dim WDApp As Word.Application
 Dim nam As String, val As String
' nam and val get a value
 WDApp.ActiveDocument.FormFields(nam).Result = val

Why the error?

Signature

Peter J. Veger, Best Netherlands

macropod - 29 Mar 2007 13:28 GMT
Hi Peter,

Try:
WDApp.ActiveDocument.Bookmarks(nam).Range.Fields(1).Result.Text = val

Cheers
Signature

macropod
[MVP - Microsoft Word]
-------------------------

> Context: WinXP pro, Office 2003
> Busy filling a Word form from an Outlook VbaProject module.
[quoted text clipped - 9 lines]
>
> Why the error?
Peter J. Veger - 31 Mar 2007 10:49 GMT
Thank you for your suggestion: it works out OK.
But my question also is: why did I get an error??
(Result is a field wit data type String, val is a value with data type
String,
and a String valuein VBA can be at least 64K characters long.)
Signature

Peter J. Veger, Best Netherlands

> Hi Peter,
>
[quoted text clipped - 15 lines]
>>
>> Why the error?
Jay Freedman - 31 Mar 2007 19:14 GMT
The answer to "why?" is "It's a bug that's been in VBA since at least
Word 2000". See
http://www.word.mvps.org/FAQs/MacrosVBA/SetLongFmFldResult.htm .

--
Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

>Thank you for your suggestion: it works out OK.
>But my question also is: why did I get an error??
[quoted text clipped - 20 lines]
>>>
>>> Why the error?
Peter J. Veger - 01 Apr 2007 21:31 GMT
Thanks,
I thought it a bug, and am glad to now know it for sure.
And next time I will first search the FAQs-website.
Signature

Peter J. Veger, Best Netherlands

> The answer to "why?" is "It's a bug that's been in VBA since at least
> Word 2000". See
[quoted text clipped - 31 lines]
>>>>
>>>> Why the error?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.