|
-
Jun 27th, 2006, 04:20 PM
#1
Thread Starter
Addicted Member
userform.show before save
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?
-
Jun 28th, 2006, 07:02 AM
#2
Lively Member
Re: userform.show before save
You should be able to use the workbook_beforesave event in ThisWorkbook for doing that...
-
Jun 28th, 2006, 01:40 PM
#3
Thread Starter
Addicted Member
Re: userform.show before save
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
-
Jun 28th, 2006, 02:00 PM
#4
Re: userform.show before save
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
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|