none
Error 5854 (String too long) with BuildingBlockEntries.Add ? RRS feed

  • Question

  • Hi,

    I'm quite surprised to receive a "String too long" error when adding a new BuildingBlockEntries by code because I'm telling to add a range not a string and I have no problem to add it manually(Word interface) and besides that Building Blocks can be very big.

    My code

    Set objBB = objTemplate.BuildingBlockEntries.Add( Name:=txtNome, _
    Type:=wdTypeCustom5, _
    Category:=myCategory, _
    Description:=txtDescrizione, _
    Range:=myRange)

    I have a table with three columns: 1°= name of BB; 2°= BB; 3°= Description. 

    Multiple rows.

    I can iterate on all the rows to insert several BB.

    For Each aRow In ActiveDocument.Tables(1).Rows ... Set MyRange = aRow.Cells(2).Range MyRange.End = MyRange.End - 1 ...

    'The insert BB above next

    I can't spot the cause of the error. MyRange can contain  2,3,4 lines of text, with text and points. The Paragraph Format can be with borders and/or background colors.

    Some time every things is OK, others fails

    Thanks for any suggestion Lauro



    • Edited by Lauro2 Monday, April 18, 2016 5:00 PM
    Monday, April 18, 2016 4:58 PM

Answers

  • >>>Hi tried to save a BB from the Word interface and you cannot use a Name longer the 32 (?) charachters.

    According to your description, I have reproduce this issue, based on my searching, Building Blocks/AutoText names have a maximum length of 32 characters and may include spaces. The number of entries and the length of their contents are limited only by the template file size and available memory. So I suggest that you make Building Block name less or equal 32 character.

    For more information, click here to refer to this link:

    http://word.mvps.org/faqs/customization/autotext.htm

    In addition if you have any feedbacks for Word, please feel free to submit them to User Voice:

    https://word.uservoice.com/

    Thanks for your understanding.
    • Marked as answer by David_JunFeng Wednesday, April 27, 2016 7:29 AM
    Wednesday, April 20, 2016 8:24 AM

All replies

  • >>>I'm quite surprised to receive a "String too long" error when adding a new BuildingBlockEntries by code 

    According to your description and error, I suggest that you could print out txtNome and txtDescrizione then check whether their lenghth is over 255 character.

    In addition could you provide more information about your issue, for example sample file, screenshot etc., that will help us reproduce and resolve it.

    Thanks for your understanding.
    Tuesday, April 19, 2016 1:56 AM
  • Hi,

    I think I found the problem.

    It seems that the first parameter (Name) of the Add methods CANNOT BE LONGER THEN 33 CHARACTERS!

    Every time I try to insert a longer name I get the Error 5854 - Parameter string too long.

    But nowhere this limitatiion is stated, as far as I know.

    Lauro

    Tuesday, April 19, 2016 3:45 PM
  • Hi tried to save a BB from the Word interface and you cannot use a Name longer the 32 (?) charachters.
    Tuesday, April 19, 2016 4:11 PM
  • >>>Hi tried to save a BB from the Word interface and you cannot use a Name longer the 32 (?) charachters.

    According to your description, I have reproduce this issue, based on my searching, Building Blocks/AutoText names have a maximum length of 32 characters and may include spaces. The number of entries and the length of their contents are limited only by the template file size and available memory. So I suggest that you make Building Block name less or equal 32 character.

    For more information, click here to refer to this link:

    http://word.mvps.org/faqs/customization/autotext.htm

    In addition if you have any feedbacks for Word, please feel free to submit them to User Voice:

    https://word.uservoice.com/

    Thanks for your understanding.
    • Marked as answer by David_JunFeng Wednesday, April 27, 2016 7:29 AM
    Wednesday, April 20, 2016 8:24 AM