To not change the name of the workbook, you can use the Save method (instead of SaveAs). However, if you open a workbook read-only, there is no way to save the workbook with the same name - you would need to open the workbook with read/write access.
Hope this helps,
Russell
I am sorry I was not clear...
I am using SaveAs since I am just trying to save a SINGLE worksheet, and in a different format.
(I am exporting one worksheet in a work book to a text file).
I do not want to have the workbook name change to the name I just exported the worksheet as.
thanks
.
Still not sure exactly what you are trying to do. Are you trying to save one sheet as a new workbook with only one sheet? What do you mean by "a different format"? Are you trying to save in something other than Excel format?
If you're just trying to make a new workbook with one sheet, use the Workbooks.Add method, then copy over your sheet, then delete the other sheets (the workbook you added probably started wtih 3 or more sheets in it). If you need code to copy the sheet over, I suggest opening 2 workbooks, then record a macro where you copy a sheet from one workbook to the other (Edit-Move or Copy Sheet...etc.).
-rh
The code should go something like this... are you doing something like it ?
Application.DisplayAlerts = False ActiveWorkbook.SaveAs FileName:="Yournewfile.txt", Fileformat:=xlText
Application.DisplayAlerts = True
I think that this way it should work. You have to be in the sheet you want to copy...