Hi There,
I have a simple find and replace macro that I would like to run. It does fine up until the text goes above 255 characters. I understand that 255 is the "magic" length. However as I understand it the Dim As STRING should allow MANY more than 255. Correct? Here is my code. Any ideas would be greatly appreciated!
Nina
Public Sub Translate()
Dim n As Integer
Dim xls As Excel.Application
Dim myxls As Excel.Workbook
Dim e As String
Dim K As String
Set xls = CreateObject("Excel.Application"
xls.Workbooks.Open "OUR Network Path"
xls.Visible = True
n = 1
xls.Range("a2".Select
e = ActiveCell.Value
K = ActiveCell.Offset(0, 1)
Do While n < 131
e = xls.ActiveCell.Value
K = xls.ActiveCell.Offset(0, 1)
With Selection.Find
.Text = e
.Replacement.Text = K
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
n = n + 1
xls.ActiveCell.Offset(1, 0).Select
Loop
End Sub
I have a simple find and replace macro that I would like to run. It does fine up until the text goes above 255 characters. I understand that 255 is the "magic" length. However as I understand it the Dim As STRING should allow MANY more than 255. Correct? Here is my code. Any ideas would be greatly appreciated!
Nina
Public Sub Translate()
Dim n As Integer
Dim xls As Excel.Application
Dim myxls As Excel.Workbook
Dim e As String
Dim K As String
Set xls = CreateObject("Excel.Application"
xls.Workbooks.Open "OUR Network Path"
xls.Visible = True
n = 1
xls.Range("a2".Select
e = ActiveCell.Value
K = ActiveCell.Offset(0, 1)
Do While n < 131
e = xls.ActiveCell.Value
K = xls.ActiveCell.Offset(0, 1)
With Selection.Find
.Text = e
.Replacement.Text = K
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
n = n + 1
xls.ActiveCell.Offset(1, 0).Select
Loop
End Sub