Dear I have this code.
Sub Macro1()
On Error Resume Next
StartTime = Now()
Dim objFSO, objFolder, objFile, strFileName, strExtension
'Dim a(1048500, 6)
Dim arr(3000)
Dim fs, a, f, mis
Dim maf As Double
Set fs = CreateObject("Scripting.FileSystemObject")
stroutpath = Range("C5").Value
'a.WriteLine ("Mobile_No,Total_Current_Charge,Current_charges_with_Tax,Monthly_Access_Fee,Outgoing_National_Calls,Outgoing_International_Calls,MOC_-_SMS_Messages,Roaming_SMS,Roaming_Incoming,Roaming_OGC,GPRS_Vol_Home,Roam_GPRS_Usage,Jinny_RBT,Call_Fwd_Calls,Excise_Duty,VAT")
If Sheet1.Range("C4").Value = "" Then
MsgBox "Enter File Path"
Exit Sub
End If
strdirpath = Range("C4").Value
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strdirpath)
For Each objFile In objFolder.Files
If InStr(1, objFile.Name, ".txt") > 0 Then
strFileName = UCase(objFile.Name)
Else: strFileName = ""
GoTo a
End If
ReadFile = strdirpath & "\" & strFileName
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Set a = fs.CreateTextFile(stroutpath & "\" & strFileName, True)
''Set b = fs.CreateTextFile(stroutpath & "\" & strFileName, True)
Set fs = CreateObject("Scripting.FileSystemObject")
Set fin = fs.OpenTextFile(ReadFile, ForReading, TristateFalse)
'ReadNextLine = False
Do While fin.AtEndOfStream <> True
readata = fin.readline
writedata = IIf(InStr(1, readata, "M,") > 1, Mid(readata, 1, InStr(1, readata, ",") - 1), "")
If Len(writedata) > 11 Then
a.writeline (writedata)
End If
Loop
a:
Next
tt = Format(Now() - StartTime, "HH:MM:SS")
MsgBox "Complete Time taken " & tt
End Sub
It only seperates 108140595000-108140595199
108140595000
108140595001
till
108140595199
for every text numbers.
But i want it to KEEP on FIX text at last of every text.