Hi again. Thank you very much!!...I've used your code with a small modification and it worked perfectly
I attach you what I changed for your information:
Dim testScriptFile As Long
Dim testLine As Integer
Dim strLine As String
Dim testScriptContent As String
Dim sBuf As String
Dim sTemp As String
Dim oB As Long, cB As Long
Dim leftPart As String, rightPart As String
Dim midPart As String, midVar As Variant
Dim newStr As String
Dim isRamp As Integer
testScriptFile = FreeFile
Open testScriptPath For Input As testScriptFile
Do Until EOF(testScriptFile)
Line Input #testScriptFile, sBuf
isRamp = InStr(sBuf, "Ramp(") ' I only want to change a specific command, so first of all I search for it the current line
If isRamp <> 0 Then ' If that commmand is contained in sBuf, proceed to change
sBuf = Replace(sBuf, "%", "")
oB = Application.Search("(", sBuf, 1)
cB = Application.Search(")", sBuf, 1)
leftPart = Left(sBuf, oB)
rightPart = Right(sBuf, Len(sBuf) - cB + 1)
midPart = Mid(sBuf, oB + 1, (cB - 1) - oB)
midVar = Split(midPart, ",")
newStr = leftPart & midVar(0) & "," & midVar(2) & "," & midVar(3) & "," & midVar(1) & rightPart ' I changed the order of the parts
sTemp = sTemp & newStr & vbCrLf
Else ' If the line does not contain the string I want to change, save the previous text
newStr = sBuf
sTemp = sTemp & newStr & vbCrLf
End If
Loop
Close testScriptFile