View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Export an excel file as text without change of document type

ActiveSheet.copy
ActiveWorkbook.SaveAs "C:\MyFolder\MyFile.txt", xlCSV
Activeworkbook.Close SaveChanges:=False

Change xlCSV to the type of text file you want.
--
Regards,
Tom Ogilvy

"Michael" wrote in message
om...
Hello,

I'm using excel to generate quite large text files. I want to save
automatically from a VB script the result of an excel sheet in a text
file. But using the "save as" function changes the document type of my
excel sheet.

Is there any option to just export the text file and leaving the Excel
sheet as it is?

Yours

Michael