Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Save
Hi, I have the following macro that saves as a filename when closed, how can I also add to the code for the fil to save as when the save icon is clicked as well along with the close icon. Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim strPath As String Dim strFilename As String Dim userResponse As Variant strFilename = "Galashiels Resources WC " & Format(Sheets("Galashiels Resources").Range("N2"), "dd-mmm-yy") userResponse = MsgBox("Do you want to save as " & strFilename, vbYesNo + vbDefaultButton2 + vbQuestion, "Galashiels Operational Resources © MN ") If userResponse = vbYes Then strPath = "C:\Users\Mark\Desktop" strFilename = strPath & "\" & strFilename & ".xls" ThisWorkbook.SaveAs Filename:=strFilename, FileFormat:=xlNormal, CreateBackup:=False End If End Sub Many thanks Mark |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Save, save as, page setup dimmed out in unprotected excel sheet? | Excel Discussion (Misc queries) | |||
prompt user to save file as {desired_name} and save it to a variab | Excel Programming | |||
Disable save, save as, but allow save via command button | Excel Programming | |||
How to diasble save and save as menu but allow a save button | Excel Programming | |||
Totally Disabling (^ save ) (Save as) and Save Icon – Which code do I use: | Excel Programming |