mdmackillop
05-29-2010, 02:54 AM
Sub SplitText()
Dim tName As String
Dim fName As String
Const ForReading = 1, ForWriting = 2, ForAppending = 3
pth = ActiveWorkbook.Path & "\"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile(pth & "sample.txt", ForReading, TristateFalse)
txt = f.readall
f.Close
Set f = Nothing
Set fs = Nothing
a = Split(txt, "<BTAG>")
For i = 1 To UBound(a)
fName = Trim(Split(a(i), "<")(0)) & ".txt"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.CreateTextFile(pth & fName, True)
f.write "<BTAG> " & a(i)
f.Close
Next
End Sub
mdmackillop
10-21-2010, 10:49 AM
Sub Macro1()
Dim t As Variant
Dim c
As Range
Set c = Range("A2")
t =
Split(c, Chr(10))
c.Resize(UBound(t)) =
Application.Transpose(t)
End Sub
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.