Results 1 to 6 of 6

Thread: error 5854 String Parameter too Long in VB6

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2005
    Posts
    37

    Question error 5854 String Parameter too Long in VB6

    Hi,
    I need to replace text more than 255 characters in word using word application in VB6. It gives me an error 5854 String parameter too long... Please help....

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: error 5854 String Parameter too Long in VB6

    find (without replace) and select the text, then input the new string into the selection

    if you want exact code do a search as i put it in 2 posts very recently

    pete

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: error 5854 String Parameter too Long in VB6

    Pass a pointer to the string instead?

    Is this VBA?

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: error 5854 String Parameter too Long in VB6

    yes it is vba

    find and replace can only handle 255 characters in the replace string

    pete

  5. #5
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: error 5854 String Parameter too Long in VB6

    Anything wrong with using the VBA Replace$? I just did a 100,000-char replace in about half a second.

  6. #6
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: error 5854 String Parameter too Long in VB6

    i am sure there are many ways to do it, but the .find.replacement.text in word 2000 is max lenght of 255 characters on my machine, over that it gives an error, same problem a few others have been having

    VB Code:
    1. With Selection.Find
    2.                           .Text = "mytest"
    3.                           .Replacement.Text = ""
    4.                           .Forward = True
    5.                           .Wrap = wdFindContinue
    6.                           .Execute
    7.                          
    8.                     End With
    9.                     Selection = mytext1 ' where mytext1 can be in excess off 255 characters

    is one way to replace the selection with a longer string

    pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width