Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Save As Text file

Hi NG,
Would appreciate any assistance with this one.
I have searched the NG and not coming up with the right result I need.
I have the following code:

Sub SaveAsTxt()

Sheets("Output").Select
Range("A2").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
Application.CutCopyMode = False

ActiveWorkbook.SaveAs Filename:="C:\Sales\" & "Sales" & Format(Now,
"yyyymmddhhmm") & ".txt", FileFormat:=xlText, _
CreateBackup:=False
ActiveWorkbook.Close SaveChanges:=False

Sheets("IMPUT").Select
Range("A2").Select

End Sub

the resulting output is as a TAB delimited text file.
I require COMMA ( , ) delimited, and contents with Double Quotes (""),
including blank fields.

Thanks in advance.
Cheers Paul

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Save As Text file

Need to use "csv" file format instead of just txt (FileFormat:=xlCSV)

Tim.

wrote in message
ups.com...
Hi NG,
Would appreciate any assistance with this one.
I have searched the NG and not coming up with the right result I
need.
I have the following code:

Sub SaveAsTxt()

Sheets("Output").Select
Range("A2").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
Application.CutCopyMode = False

ActiveWorkbook.SaveAs Filename:="C:\Sales\" & "Sales" & Format(Now,
"yyyymmddhhmm") & ".txt", FileFormat:=xlText, _
CreateBackup:=False
ActiveWorkbook.Close SaveChanges:=False

Sheets("IMPUT").Select
Range("A2").Select

End Sub

the resulting output is as a TAB delimited text file.
I require COMMA ( , ) delimited, and contents with Double Quotes
(""),
including blank fields.

Thanks in advance.
Cheers Paul



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Save As Text file

Thanks Tim, that's a help.
Cheers Paul

Tim Williams wrote:
Need to use "csv" file format instead of just txt (FileFormat:=xlCSV)

Tim.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you save an excel file to be read as IBM-type text file ? Dee Franklin Excel Worksheet Functions 2 October 10th 06 02:46 AM
Save CSV file as Pipe delimited text file germantim Excel Discussion (Misc queries) 3 August 16th 06 09:52 AM
How can I save a file as a comma-delimited text file in Excel? LAM Excel Discussion (Misc queries) 1 May 3rd 05 10:24 PM
Excel VBA - open text file, replace text, save file? Cybert Excel Programming 2 October 2nd 04 01:05 AM
Save As - Multiple Sheets fails to save as text file Ravee Srinivasan Excel Programming 2 November 10th 03 04:05 PM


All times are GMT +1. The time now is 02:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"