Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Closing the Userform when macro is running
Hi,
I've created an add-in that, upon pressing the button, a userform appears and different macro codes execute depending on the user's command-button choice. After the user presses a command button, the macro springs into action, and will often run for 1min or so. What I would like to do is to have that userform close after the user presses the command button and starts off the macro. My setup is like this: Add-in button code: Sub ShowForm() Myform.show End Sub ----------- This shows the userform. I then have code within each command button. Thanks for your help in advance! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Closing the Userform when macro is running
Something like:
Unload UserForm1 should do it. -- Vasant "SuperJas" wrote in message ... Hi, I've created an add-in that, upon pressing the button, a userform appears and different macro codes execute depending on the user's command-button choice. After the user presses a command button, the macro springs into action, and will often run for 1min or so. What I would like to do is to have that userform close after the user presses the command button and starts off the macro. My setup is like this: Add-in button code: Sub ShowForm() Myform.show End Sub ----------- This shows the userform. I then have code within each command button. Thanks for your help in advance! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Closing the Userform when macro is running
Hi Vasant,
Thanks for your tip. However, I've tried it and it still doesn't unload/hide as I'd like. I've pasted the "Unload Myform" line in the command-button code section. When I run the code via the "Step-into" method, the userform does close, but when I run it normally it doesn't... So I'm thinking this might have something to do with the "Application.Screenupdating=False" command. However, this line is below the "Unload Myform" line, so I can't figure out what the problem is... Thanks for your time! ----- Vasant Nanavati wrote: ----- Something like: Unload UserForm1 should do it. -- Vasant |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Closing the Userform when macro is running
Jas,
You might want to try Userform1.Hide and/or DoEvents to make the form display go away. Are you using a modeless form? Alex J "SuperJas" wrote in message ... Hi Vasant, Thanks for your tip. However, I've tried it and it still doesn't unload/hide as I'd like. I've pasted the "Unload Myform" line in the command-button code section. When I run the code via the "Step-into" method, the userform does close, but when I run it normally it doesn't... So I'm thinking this might have something to do with the "Application.Screenupdating=False" command. However, this line is below the "Unload Myform" line, so I can't figure out what the problem is... Thanks for your time! ----- Vasant Nanavati wrote: ----- Something like: Unload UserForm1 should do it. -- Vasant |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Closing the Userform when macro is running
If you don't want to close the form out completely you can use:
UserForm1.Hide instead of Unload UserForm1 "Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message ... Something like: Unload UserForm1 should do it. -- Vasant "SuperJas" wrote in message ... Hi, I've created an add-in that, upon pressing the button, a userform appears and different macro codes execute depending on the user's command-button choice. After the user presses a command button, the macro springs into action, and will often run for 1min or so. What I would like to do is to have that userform close after the user presses the command button and starts off the macro. My setup is like this: Add-in button code: Sub ShowForm() Myform.show End Sub ----------- This shows the userform. I then have code within each command button. Thanks for your help in advance! |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Closing the Userform when macro is running
Hi Alex,
Thanks for your tip! It turned out that the "DoEvents" command was needed to hide/close the userform. kfarmer, thanks for your suggestion. I haven't given much thought as to whether to unload or hide the form...would the choice affect performance? For now I've chosen the hide property purely because I'm more used to that... Thanks, Vasant, Alex, and Kfarmer for your time! =) Jas. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Auto running a macro on closing | Excel Discussion (Misc queries) | |||
Userform won't show after closing another file | Excel Discussion (Misc queries) | |||
Re-show userform after closing file - code help | Excel Discussion (Misc queries) | |||
userform titlebar and closing form | Excel Programming | |||
Help with closing a UserForm | Excel Programming |