PDA

View Full Version : Solved: need to add a macro on save



niyrho
07-31-2008, 02:20 PM
I need a code that will, when you hit save, take the value from A12 and H10 and use it as the file name to save it to the folder "time sheets".
Can anyone give me a hand?

Bob Phillips
07-31-2008, 02:34 PM
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Dim sFile
Application.EnableEvents = False
'<Optional - this would be before save code>
If SaveAsUI Then
'continue
Else
Cancel = True
ThisWorkbook.SaveAS Activesheet.Range("A12").Value & Activesheet.Range("H10").Value
End If
Application.EnableEvents = True
End Sub

niyrho
08-24-2008, 06:01 PM
That code did even less. Any other solutions?