I am looking to input text from a varying number of cells into Word by using a find and replace funtion. The cell content is longer than 255 characters and therefor giving me an error. any suggestions?
Thanks!
I am looking to input text from a varying number of cells into Word by using a find and replace funtion. The cell content is longer than 255 characters and therefor giving me an error. any suggestions?
Thanks!
This is what I have so far - but am getting the "string parameter too long" error
Dim xl As Excel.Application
Dim wkbk As Excel.Workbook
Dim wk As Excel.Worksheet
Set xl = CreateObject("Excel.Application")
Set wkbk = xl.Workbooks.Open("C:\Users\..............xlsx")
Set wk = wkbk.Sheets(1)
Dim placeholder() As String
Dim prompt() As String
Dim i As Integer
bb = wk.Range("E2").Value
ReDim num_identifiers(1 To bb)
ReDim placeholder(1 To bb)
ReDim prompt(1 To bb)
For i = 1 To bb
placeholder(i) = wk.Cells(2 + i, 1)
prompt(i) = wk.Cells(2 + i, 2)
With Selection.Find
.Text = placeholder(i)
.Replacement.ClearFormatting
.Replacement.Text = prompt(i)
.Execute Replace:=wdReplaceAll, Forward:=True, _
Wrap:=wdFindContinue
End With
Next i
Workbooks.Close
End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks