|
-
Jun 17th, 2006, 10:29 AM
#1
Thread Starter
New Member
[RESOLVED] How VBA change to sheet in workbook on close, without question "Do you want to save"?
Hi.
In both Workbook_BeforeClose and Workbook_Open I need to change color index for some cells.
If the user have not made any changes to the sheet, except for those changes that where done in the BeforeClose and Open of the Workbook, I would prefer not to get the question "Do you want to save the changes you made to ...."
Is that possible? .. How
-
Jun 17th, 2006, 11:24 AM
#2
Re: How VBA change to sheet in workbook on close, without question "Do you want to save"?
Yes, two ways. One calll a .Save on the workbook to automatically save the book. If its the first time then it will prompt for a location. Or you could use the .SaveAs and supply the location and filename. Or not save at all and mark it as .Saved = True to fool Excel but your changes will be lost.
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 
-
Jun 17th, 2006, 01:08 PM
#3
Thread Starter
New Member
Re: How VBA change to sheet in workbook on close, without question "Do you want to sa
Thanks for the answer.
That sound like a good idea.
I could use:
Saved = True in workbook_open after my initial changes.
Then in Workbook_BeforeClose I could check if
the user has made any changes.
If he has not: then I could use: Saved = True
If he has then I would not use: Saved = True
So... How can I check if the workbook has been changed by the user?
Any suggestions?
-
Jun 17th, 2006, 01:16 PM
#4
Thread Starter
New Member
Re: How VBA change to sheet in workbook on close, without question "Do you want to sa
Got it now:
I can use
ThisWorkbook.Saved = True
after my code in excel open
and check against that code before i make any changes in
Workbook_BeforeClose
if any changes have not been done then I use
ThisWorkbook.Saved = True after my changes in Workbook_BeforeClose
Works like a charm...
Thanks a lot !!!!
Last edited by bongobongo; Jun 17th, 2006 at 01:20 PM.
-
Jun 17th, 2006, 03:36 PM
#5
Re: How VBA change to sheet in workbook on close, without question "Do you want to save"?
Np, glad to help. 
Ps, dont forget to 'Resolve' your thread so other members will know its solved.
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
|