MrExcel Consulting
Your One Stop for Excel Tips & Solutions

Auto open and auto close Macros


Posted by Papey on February 07, 2001 6:18 AM

I need help writing Auto open and Auto close Marcos. i have been told i will have to write it in VBA. also i would like the macro to save the work before exiting Excel

Posted by Bobby on February 07, 2001 1:32 PM


Here is what i have used I just can't save as a different filename based on a cells value.


Private Sub Workbook_Open()

X = Sheets("Sheet1").Cells(1, 1).Value

ActiveWorkbook.SaveAs FileName:= _
"D:\" & X & ".xls", _FileFormat:=xlExcel9795, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False

Application.Quit

Hope this helps

Bobby