Macro not saving file in excel format [Solved/Closed]

Posts
368
Registration date
Monday February 7, 2011
Status
Contributor
Last seen
September 30, 2013
- Feb 15, 2011 at 05:20 AM - Latest reply:
Posts
368
Registration date
Monday February 7, 2011
Status
Contributor
Last seen
September 30, 2013
- Feb 21, 2011 at 12:23 AM
Hello,


I have a coding like this:
filename = Range("B3").Value
Workbooks.Add
    Set newwb = ActiveWorkbook
    ChDir "D:\P3\Jan-11\B2B"
    ActiveWorkbook.SaveAs filename, FileFormat _
        :=xlExcel8, Password:="", WriteResPassword:="", ReadOnlyRecommended:= _
        False, CreateBackup:=False


I am using excel2007 but I have to save file in excel2003.

by this command the file is saved with said name but the file type is not excel, the type just come as "file". on the contrary some files are saving in excel format when I excute the code again and again.

kindly help me whats wrong in the code.

Thanks!
Rahul
See more 

4 replies

Best answer
Posts
368
Registration date
Monday February 7, 2011
Status
Contributor
Last seen
September 30, 2013
- Feb 18, 2011 at 03:05 AM
1
Thank you
there is no difference is file all are excel 2007 files. if I loop the above code at after every 3 iteration the program save .xls file but other as just file type.

Thank you, RWomanizer 1

Something to say? Add comment

CCM has helped 1689 users this month

Posts
4481
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
January 6, 2016
- Feb 18, 2011 at 11:18 AM
what if you put a ".xls" yourself with the file name ?
Posts
368
Registration date
Monday February 7, 2011
Status
Contributor
Last seen
September 30, 2013
- Feb 21, 2011 at 12:23 AM
its works

Thanks!
Posts
4481
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
January 6, 2016
- Feb 17, 2011 at 08:27 AM
0
Thank you
so what is the difference between the files that gets saved properly and those that do not