Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 14th, 2005, 06:05 AM
Authorized User
 
Join Date: Dec 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Form Hide and terminate

Hi,

I am trying to hide a VBA excel form and wrote a piece of code in userform_deactivate(). But the control is not passing through the deactivate. Can any one tell me why?? There is another way by using "unload me" and userform_terminate() but, i dont want to use this.

So, what i want to know, How to execute a piece of code when form hides.

Thanks

Johnson
 
Old January 15th, 2005, 03:55 PM
Registered User
 
Join Date: Dec 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sebdanger
Default

The only way is to use UserForm_Terminate that works for me any way.
 
Old January 15th, 2005, 04:26 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The code you write in Userform_deactivate is not executed before you deactivate the userform. You dont use it to deactivate the form.

If you want to hide the userform without terminating it, use Me.Hide or the userforms name instead of Me.

Likewise use 'userformname'.Show to view it again (from another form or worksheet, which of cause means you cant use Me.).
 
Old January 15th, 2005, 04:39 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Didn't notice the last part of your Q.

Hiding the userform doesn't mean you can't execute some other code. E.g. if you hide the userform by clicking a button you could code this in the button click event:

Me.Hide
Me.BackColor = vbRed

Check it out - put at button in your worksheet and add this code:

'userformname'.show
 
Old January 17th, 2005, 07:55 AM
Authorized User
 
Join Date: Dec 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your reply Birger... that's what i did finally.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Terminate Process (How To) Nova Beginning VB 6 3 October 14th, 2006 02:37 PM
Hide application windows when using Pop-Up form mmcdonal Access VBA 4 October 25th, 2005 06:31 AM
terminate a thread problem lmadhavi Visual C++ 0 November 23rd, 2004 06:20 AM
Hide Tabs in a Form Based on a field. snoopy92211 Access VBA 1 November 18th, 2004 02:33 PM
Resize and Hide columns in WEB FORM Datagrid? Ron Howerton Classic ASP Basics 5 April 30th, 2004 07:42 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.