Help With Macro

  • Thread starter Thread starter Keven
  • Start date Start date
K

Keven

I have written an excel 2003 macro that imports a comma
delimited text file and makes a couple of basic formating
changes to it. what I would like to do is find a way that
I could save this file with a file name of (current
date).xls any help with this would be greatly appreciated.


Thanks,
Keven
 
Public Sub SaveAsDate()
ActiveWorkbook.SaveAs Filename:= CStr(Format(Now, "mmmm dd yyyy")
End Su

----- Keven wrote: ----

I have written an excel 2003 macro that imports a comma
delimited text file and makes a couple of basic formating
changes to it. what I would like to do is find a way that
I could save this file with a file name of (current
date).xls any help with this would be greatly appreciated


Thanks
Keve
 
That save it in a date format, but for some reason in is
saving it as a .txt file, I would like it to save as .xls
workbook if that is possible ?

Thanks,
Keven
 
ActiveWorkbook.SaveAs Filename:=CStr(Format(Now, "mmmm dd yyyy")), _
FileFormat:=xlNormal

Since you opened a text file and are now saving it again after a few
changes, I believe that the SaveAs method uses the same format by default. A
normal Excel format is used when the file to be saved is a new one.
Therefore, you have to specify the FileFormat argument. This is one of those
tricky cases where you have to read the VBA Help topics very carefully.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top