View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] paul.robinson@it-tallaght.ie is offline
external usenet poster
 
Posts: 789
Default Save Button in Excel

On Mar 8, 2:31 pm, wrote:
I want to add a Save button on to an Excel spreadsheet that will
automatically save the sheet to a predetermined location with a
filename like Mike08March07. The idea is that the user can open the
template file everyday and each days recordings will be saved into the
predetermined location e,g F:/Jobs2007/. I dont want to create a form
but just add a button from the Control Toolbox, drop it onto the
worksheet and write the code for it.Does anyone know how to do this?


This will save with todays date.

Sub SaveIt()
Dim FullName as String
FullName = "Mike" & Format(Date, "dd mmm yy") & ".xls"
ThisWorkbook.SaveAs ("F:\Jobs2007" & "\" & FullName)
End Sub

Add a button from the forms menu (View, Toolbars, forms). Click on New
when it asks for a macro and paste in the above macro instead of the
one offered. Go back to the sheet with the button on, right click it
and select the above macro to attach.

regards
Paul