View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
[email protected] ilya2@rcn.com is offline
external usenet poster
 
Posts: 2
Default How do I export data in text format with minimum of spaces?

The following macro exports a specified portion of Excel file as
a .prn:

Sub ExportA1()

Sheets("A1").Select
ActiveWindow.SmallScroll Down:=-3
Range("D321:AR350").Select
Selection.Copy
Sheets.Add
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWorkbook.SaveAs Filename:= _
"Detail.prn", FileFormat:=xlTextPrinter, CreateBackup:=False
End Sub

The output looks more or less like this:

SKU 01 0 570511455 2 1
2.49 2.49
SKU 01 0 570511455 2 1
14.99 -1.50 13.49

Whereas I want it to look like this:

SKU 01 0 570511455 2 1 2.49 2.49
SKU 01 0 570511455 2 1 14.99 -1.50 13.49

Does SaveAs have a parameter which would compress any sequence of
spaces into one space?