You would have to create your own text file and write it out that way. Here's a simple example:
-----------------------------------------------------------------------
Private Sub ButtonName_Click()
' Writes out first 4 columns as special formatted comma separated values
Dim oPageName As Object, sToWrite As String, iRowOn As Long
Set oPageName = CreateObject("Scripting.FileSystemObject") _
.CreateTextFile("C:\MyFile.txt", True)
iRowOn = 1
Do While ActiveSheet.Cells(iRowOn, 1).value <> "" 'stops at first blank line... or whatever criteria you have
sToWrite = ""
With ActiveSheet
sToWrite = PreFormat(.Cells(iRowOn,1).Value) & "," & PreFormat(.Cells(iRowOn,2).Value) & "," _
& PreFormat(.Cells(iRowOn,3).Value) & "," & PreFormat(.Cells(iRowOn, 4).Value) 'Could loop this if > 3 or 4
End With
oPageName.WriteLine(sToWrite)
iRowOn = iRowOn + 1
loop
oPageName.Close
End Sub
Private Function PreFormat(sPassed As Variant) As String
' Makes sure at least 4 characters, pads with leading spaces
PreFormat = "" & Trim(sPassed)
Do While Len(PreFormat) < 4
PreFormat = " " & PreFormat
Loop
PreFormat = """" & PreFormat & """"
End Function
-----------------------------------------------------------------------
Hope this helps.
|