Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-21-2019, 02:59 AM
irinarox irinarox is offline Word Macro give errror that string is too long - how to fix it Windows 10 Word Macro give errror that string is too long - how to fix it Office 2016
Novice
Word Macro give errror that string is too long - how to fix it
 
Join Date: May 2019
Posts: 9
irinarox is on a distinguished road
Default Word Macro give errror that string is too long - how to fix it

Hi guys,


I am trying to write a Macro to replace a string of text with another one, but I receive an error for the text to replace - run time error 5854 - string parameter is too long. I know that the string has more than 255 characters, but I cannot change it and I cannot split it in 2 commands.



Code it like below:
Let Address2 = "{Insert shop address}"
Let Localizedaddress1 = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxx xxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"


Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = Address2
.Replacement.Text = Localizedaddress1
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll


Can you please help with how should I modify it in order to work?


Thank you!
Irina
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
inputing japanese string in word's macro = ?? tyki Word VBA 0 02-29-2016 03:09 AM
Word Macro give errror that string is too long - how to fix it How to give multiple styles while inserting string PRA007 Word VBA 4 01-18-2016 12:00 AM
One long string of text with ; as the delimiter Laurie B. Excel 1 02-28-2015 03:02 AM
Word Macro give errror that string is too long - how to fix it Macro to create new word doc and save the file using String found in the document VBNation Word VBA 2 02-08-2013 07:14 AM
Renaming Word Formfields: string too long error silverspr Word VBA 7 01-22-2013 06:20 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:48 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft