Capoerista
Programmer
Hi All,
I am having problems with the following bit of code. The RTF handling is behaving differently on two PC's, both with Win 2000 professional. One has Office 2002 (works OK), the other has Office 2003. The code is in a VB6 application and is used to strip out the RTF 'control' codes to leave a plain text file. In particular the TS.ReadAll does not seem to be doing this on latter PC. Does anyone know if any changes have been made to RTF handling routines and is there something that I may need to install or coding changes to consider.
Thanks in advance
Adrian
Dim TS As Scripting.TextStream
Dim NewIn
Load frmEmail_2_OTC
Set TS = fs
penTextFile(INPUT_FILE, ForReading)
frmEmail_2_OTC.rtfTemp.TextRTF = TS.ReadAll
TS.Close
NewIn = fso.GetParentFolderName(INPUT_FILE) & "\OrigRTF_" & fso.GetFileName(INPUT_FILE)
If fso.FileExists(NewIn) Then
Kill NewIn
End If
Name INPUT_FILE As NewIn
'Name Run_File as
Set TS = fs
penTextFile(INPUT_FILE, ForWriting, True)
'Dim Res As String
Dim lins, ln, Lin
lins = Split(Trim(frmEmail_2_OTC.rtfTemp.Text), vbCrLf)
LineCount = UBound(lins)
For ln = UBound(lins) To 0 Step -1
If Trim(lins(ln)) <> "" Then
Exit For
Else
LineCount = LineCount - 1
End If
Next
For ln = 0 To LineCount
Lin = lins(ln)
Debug.Print Lin & vbCrLf
If Trim(left(Lin, 4)) = "____" Then
Lin = Space(Len(Lin))
End If
TS.Write Lin & vbCrLf
Next
TS.Close
Unload frmEmail_2_OTC
I am having problems with the following bit of code. The RTF handling is behaving differently on two PC's, both with Win 2000 professional. One has Office 2002 (works OK), the other has Office 2003. The code is in a VB6 application and is used to strip out the RTF 'control' codes to leave a plain text file. In particular the TS.ReadAll does not seem to be doing this on latter PC. Does anyone know if any changes have been made to RTF handling routines and is there something that I may need to install or coding changes to consider.
Thanks in advance
Adrian
Dim TS As Scripting.TextStream
Dim NewIn
Load frmEmail_2_OTC
Set TS = fs
frmEmail_2_OTC.rtfTemp.TextRTF = TS.ReadAll
TS.Close
NewIn = fso.GetParentFolderName(INPUT_FILE) & "\OrigRTF_" & fso.GetFileName(INPUT_FILE)
If fso.FileExists(NewIn) Then
Kill NewIn
End If
Name INPUT_FILE As NewIn
'Name Run_File as
Set TS = fs
'Dim Res As String
Dim lins, ln, Lin
lins = Split(Trim(frmEmail_2_OTC.rtfTemp.Text), vbCrLf)
LineCount = UBound(lins)
For ln = UBound(lins) To 0 Step -1
If Trim(lins(ln)) <> "" Then
Exit For
Else
LineCount = LineCount - 1
End If
Next
For ln = 0 To LineCount
Lin = lins(ln)
Debug.Print Lin & vbCrLf
If Trim(left(Lin, 4)) = "____" Then
Lin = Space(Len(Lin))
End If
TS.Write Lin & vbCrLf
Next
TS.Close
Unload frmEmail_2_OTC