-
Excel VBA - Closing Entire Spreadsheet From UserForm
This is the first time I've ever used a UserForm with Excel (or actually done any coding in VBA for that matter).
I have a UserForm. When I close it, the underlying excel spreadsheet (which is completely blank and used for no other purpose than as a home for the userform) is still displayed on the screen and must be closed as well.
On the userform, I tried
Code:
Private Sub UserForm_Deactivate()
Workbooks.Close
End Sub
But that didn't do anything.
Can I cleanly close both when I shutdown the userform?
-
-
If you don't want to exit excel, just close the workbook then use:
Code:
ActiveWorkbook.Close
'..Or..
Workbooks(1).Close
Remember Workbooks is a collection so you need to specify which workbook, even if only one is open.
-
That is good to know, but I think in this instance, closing Excel would be the way to go.
Similar Threads
-
By slimasian in forum .NET
Replies: 0
Last Post: 05-15-2008, 04:24 PM
-
By scgamecock in forum VB Classic
Replies: 1
Last Post: 10-24-2007, 01:40 AM
-
By blayne in forum VB Classic
Replies: 1
Last Post: 11-17-2005, 07:14 PM
-
By Nishith Prabhakar in forum ASP.NET
Replies: 0
Last Post: 06-03-2003, 09:59 AM
-
By Miroslav St. Jeliaskoff in forum .NET
Replies: 4
Last Post: 10-03-2002, 09:08 AM
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
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|