Regardless of whether you want to "want to play with text and not the rtf as opened in word", that doesn't mean you can't open the file as text in Word and process it as such. For example:
Code:
Sub Demo()
Dim wdDoc As Document
Set wdDoc = Documents.Open(FileName:="C:\Users\rahul\Desktop\PLR\1.rtf, Format:=wdOpenFormatText, AddToRecentFiles:=False)
With wdDoc
'process here
.Close SaveChanges:=True
End With
End Sub
That said, here is another macro you could use in any Office application:
Code:
Sub EditRTFFile()
'Requires a reference to Microsoft VBScript Regular Expressions 5.5
Dim DataFile As String, TextLine As String, Data As String, regEx
DataFile = "C:\Users\rahul\Desktop\PLR\1.rtf"
Set regEx = CreateObject("vbScript.RegExp")
Data = ""
Open DataFile For Input As #1
Do Until EOF(1)
Line Input #1, TextLine
On Error Resume Next
With regEx_
.Global = True
.MultiLine = True
.IgnoreCase = True
.Pattern = "\{\\\w{4}\\\w{4}\\\w{11}"
TextLine = regEx_.Replace(TextLine, "mmrk$&")
End With
Data = Data & TextLine & vbCrLf
Loop
Close #1
Open DataFile For Output As #1
Print #1, Data
Close #1
Set regEx = Nothing
End Sub
The above assumes you have a reason for processing the file one line at a time, rather than just opening it as a text file and simply processing all lines together.