Is it possible that when someone tries to save an Excel's workbook, either by clicking on save button or through the File tab, a userform appears and ask for some data fields before actually saving the file?
Printable View
Is it possible that when someone tries to save an Excel's workbook, either by clicking on save button or through the File tab, a userform appears and ask for some data fields before actually saving the file?
You should be able to use the workbook_beforesave event in ThisWorkbook for doing that...
Is it possible to cancel the saving? I tried Exit Sub but it doesn't work...
VB Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Form.Show If save = 0 Then Exit Sub End If End Sub
Show the form modally so it holds up code execution in the beforesave event.
VB Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Form.Show vbModal If save = 0 Then Exit Sub End If End Sub