dean.rogers
New Member
- Joined
- Apr 6, 2012
- Messages
- 31
Hey all,
I am running into this error which is making things difficult when trying to find and replace.
The error is:
Run-time error '5854':
String parameter too long
I take it there is a character limit when using the find and replace and if there is a way around it, it would be GREAT!!
here is the code that i currently use to find/replace from excel to word:
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Open("C:Templates\Template1.docx")
Set wrdDocSelection = wrdApp.Selection
With wrdDocSelection.Find
.Text = "[company_name]"
.MatchWholeWord = False
.Replacement.Text = ActiveWorkbook.Sheets("Sheet2").Range("D3")
.Execute , , , , , , , , , , wdReplaceAll
Thanks for the help
I am running into this error which is making things difficult when trying to find and replace.
The error is:
Run-time error '5854':
String parameter too long
I take it there is a character limit when using the find and replace and if there is a way around it, it would be GREAT!!
here is the code that i currently use to find/replace from excel to word:
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Open("C:Templates\Template1.docx")
Set wrdDocSelection = wrdApp.Selection
With wrdDocSelection.Find
.Text = "[company_name]"
.MatchWholeWord = False
.Replacement.Text = ActiveWorkbook.Sheets("Sheet2").Range("D3")
.Execute , , , , , , , , , , wdReplaceAll
Thanks for the help