Hi John,
There are two ways you could do this:-
The first would be to use the file operation methods in VBA such as Write and Print. The second, and much simpler way is to use a macro to copy the selection to a new workbook and save that as text. Something like this will do the trick:-
Sub SaveColumns()
Dim rnge As Range, wb As Workbook
On Error GoTo ErrHandler
Application.ScreenUpdating = False
Set rnge = Selection
rnge.Copy
Set wb = Workbooks.Add
wb.Sheets(1).Range("a1").PasteSpecial xlPasteValues
wb.SaveAs "C:\temp\filename.txt", xlText
wb.Close False
Application.ScreenUpdating = True
Exit Sub
ErrHandler:
Application.ScreenUpdating = True
MsgBox "Error number - " & Err.Number & vbCrLf & "Error description - " & Err.Description
End Sub
HTH,
D
Hide the columns that you don't want to save,
choose the File | Save As... menu command,
and use the "Formatted Text (Space delimited)
(*.prn)" Save as type.
Thanks Mark for your help the example worked great.
Thanks your example worked perfect too!