Archive of Mr Excel Message Board


Back to Excel VBA archive index
Back to archive home



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

Check out our Excel VBA Resources

Re: Auto open and auto close Macros

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




This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.