Saving Excel workwook

C

Candyman

I have an Application that exports Recordsets out to Excel. It opens the
file, saves multiple recordsets, calculates, and now I want to save this file
with multiple filenames after deleting unnecessary tabs per department. So I
delete all but Summary and the 'Mens Dept' tabs and graphs.

How do I save the file as a particular name?

Error:"Object does not support this property or method."

I have a portion of the code that calculates and deletes any preceding file
of the same path and name. These work. it jams on the SaveAs line:
With xlsApp.Application
.Calculate
.Run ("Preparation.ConvertMe")
.DisplayAlerts = False
If FileExists(All_Filename) = True Then Kill All_Filename
.Workbooks.SaveAs FileName:=All_Filename
.Workbooks.Close
End With

Any hints?

I really need to loop through the different departments, but I think I can
get that part.
Much thanks.
Candyman
 
S

Stefan Hoffmann

hi,
.Workbooks.SaveAs FileName:=All_Filename
..SaveAs is a method of Workbook and not of the Workbooks collection.
Any hints?
As you are using early binding, you can press F2 in the VBA. Select the
Excel library and search for SaveAs in the object browser.


mfG
--> stefan <--
 
C

Candyman

Thanks I did not know about the F2 functon. I did find out I could call a
macro to run within Excel and do all I wanted. I found some other useful
code in the excel group. the code does a SaveCopyAs and alows me to reopen
the workbook, remove any macros, and close.
 
Top