xlsm SaveAs xls
Gord
I figured it out. ThisWorkbook is an .xlsm wb and is in the same folder
as the 5 .xls files that the code opens and closes. What was happening was
that the code was trying to open that .xlsm file, which was already open.
The "DisplayAlerts=False" line prevented the display advising the above, so
I never saw it. The code stopped cold at that point. Apparently the line
TheFile = Dir("*.xls") picks up any file that has "xls" after the period
and .xlsm has that. Of course that was never a problem until 2007 came out.
I trapped it with an IF statement that TheFile=ActiveWorkbook.Name and all
works good now. I thought you might want to know. Otto
"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
Otto
Using.......................
Sub saver()
Dim Wbname As String
Wbname = "Anything"
ActiveWorkbook.SaveAs Filename:= _
ThePath & "\" & Wbname & ".xls", FileFormat:=xlExcel8
End Sub
Anything.xls winds up in C:\
Maybe change ThePath to ActiveWorkbook.Path
Gord Dibben MS Excel MVP
On Fri, 11 Dec 2009 13:42:24 -0500, "Otto Moehrbach"
wrote:
Excel 2007 Win 7 64-bit
With VBA I'm trying to save an xlsm file as an xls file. It didn't work.
That is, after saving, the xls file does not exist and the active file is
the starting xlsm file.
I recorded a macro as I did the SaveAs and got the code (after modifying
the
recorded code):
ActiveWorkbook.SaveAs Filename:= _
ThePath & "\" & WbName & ".xls", FileFormat:=xlExcel8
where WbName is "Anything".
Again, the active file is the xlsm file and the Anything.xls file does not
exist.
How do I code this? Thanks for your time. Otto
|