excel 2002 to 2003- macro doesnt save as xls

  • Thread starter Thread starter bob-the-k
  • Start date Start date
B

bob-the-k

PC was rebuilt at work, so new harddrive and new software.
This saved as .xls in EXCEL 2002, BUT NOT IN 2003!!!???

ChDir "H:\MY DOCUMENTS ON H DRIVE"
ActiveWorkbook.SaveAs Filename:= _
"H:\MY DOCUMENTS ON H DRIVE\WEEKLYCPUW.E." & Worksheets
(1).Range("k3").Value & "", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False, _
CreateBackup:=False
 
Bob -

What's in Worksheets(1).Range("k3")? The command you show saves in Excel
workbook format. Are you sure it isn't a workbook without the ".XLS"?
I've seen how different versions of Excel use or don't use the file
extension if you don't state it. Maybe not in the SaveAs method, but in
some situations.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______
 
Properties @ 2002 were:
WEEKLYCPUW.E.08272004.xls
TYPE OF FILE: MICR EXC WORKSHEET
OPEN WITH: MIC EXC

Properties @ 2003 are:
WEEKLYCPUW.E.08272004
TYPE OF FILE: 8272004 FILE
OPEN WITH: UNKNOWN APPLICATION
 
I'm sure the files are identical. Windows doesn't know it's an Excel
workbook without the .xls extension.

I'll ask my question again: What's in Worksheets(1).Range("k3")?

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______
 
k3 has the date 08272004
-----Original Message-----
I'm sure the files are identical. Windows doesn't know it's an Excel
workbook without the .xls extension.

I'll ask my question again: What's in Worksheets(1).Range ("k3")?

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______



.
 
I got to have xls as the filetype so when I scan my files,
I can find my charts. I guess the obvious ? is if 2003
isn't putting xls on, how can I put the xls on? Thanks for
your help.
 
Bob -

Just as I thought, your filename didn't have the extension on it. Simple
enough to insert it this way:

'' This line is probably unneeded
ChDir "H:\MY DOCUMENTS ON H DRIVE"

'' Include the extension here:
ActiveWorkbook.SaveAs Filename:= _
"H:\MY DOCUMENTS ON H DRIVE\WEEKLYCPUW.E." & _
Worksheets(1).Range("k3").Value & ".xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="",_
ReadOnlyRecommended:=False, CreateBackup:=False

Perhaps the older edition decided it was smarter than you, and added an
extension which you didn't want.

I recently had a similar problem. A client wanted a workbook saved with
an extension of .DAT, so the line above had this argument:

Filename:="File.DAT"

Fine, great, saved all the time as File.DAT. Then he decided he wanted
it to say "File.DATA". Excel XP decided that since I didn't have a
standard extension (with 3 characters), I must have forgotten it. So the
file was saved as "File.DATA.xls".

The workaround was to use a trailing dot, which tells Excel not to add
an entension. I think it was for filenames without any extension, but it
also preserves the four-letter extension in "File.DATA", which now is
saved perfectly.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______
 
Back
Top