Thread: Saving a file
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Saving a file

fileformat is not like the filefilter--where you want to give a choice.

You tell excel the format you want to use:

ActiveWorkbook.SaveAs DataFileName, FileFormat:=xlworkbooknormal

See VBA's help for all the different fileformats you can use.

Dan wrote:

I have the following statements:

DataFileName = Application.GetOpenFilename(fileFilter:="Text or ASC Files,
*.txt; *.asc", Title:="Select the Data File")

...code

'Saves The File (As Sheetx) And Leaves It Open
ActiveWorkbook.SaveAs

'Saves File As DataFileName But With The Extension Of the File Opened TXT
Format And Not In Excel Format
ActiveWorkbook.SaveAs (DataFileName)

'Receive Syntax Error
ActiveWorkbook.SaveAs (DataFileName, FileFormat:="Excel (*.xls), *.xls")

What am I missing?


--

Dave Peterson