Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Assume the values are in sheet1, cells A1, B1, C1 in the order you describe
You can use the Beforeclose event Private Sub Workbook_BeforeClose(Cancel As Boolean) On Error goto ErrHandler application.EnableEvents = False sPath = ThisWorkbook.Path if Right(spath,1) < "\" then _ sPath = sPath & "\" Application.DisplayAlerts = False with thisWorkbook.Worksheets("Sheet1") ThisWorkbook.SaveAs FileName:= sPath & .Range("A1").value & "_" & .Range("B1").Value & _ "_" & .Range("C1").Value & ".xls" End With Application.DisplayAlerts = False ErrHandler: Application.EnableEvents = True End Sub This code would be placed in the ThisWorkbook Module. It forces a save of the workbook which is not always desirable. If you are not familiar with events, seee Chip Pearson's page on Events: http://www.cpearson.com/excel/events.htm -- Regards, Tom Ogilvy "Sinex" wrote in message ... Hi, I made an Excel sheet (say Form.xls). There are 3 fields which a user will fill (say First, Middle & Last Name). When the user closes the file, I want to rename the file to FirstName_MiddleName_LastName.xls (using the values entered in the sheet). Is this possible using some macro....renaming a file while the file is still open sounds like an issue. ...manoj |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Renaming an excel file that is Linked. | Excel Worksheet Functions | |||
Excel Renaming Files When Opening Using File Convertor | Excel Discussion (Misc queries) | |||
Renaming A File | Excel Discussion (Misc queries) | |||
Excel renaming file to a temp and deletes original (long) | Excel Programming | |||
Renaming a file | Excel Programming |