View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Userform - what am I missing?

That's exactly what I thought and what I want, but it's not running
after I click "Next" or "Finish".


I assume that "Next" and "Finish" refer to buttons on the userform.
Those buttons should (after anything else) Hide the form with Me.Hide
or unload the form with Unload Me. If you use Unload, the form is
dumped from memory and you cannot access the form's values. If you use
Hide, you can still get form values after the form is closed. Do not
use "End" (not to be confused with "End Sub" or other "End" code --
this means just "End" by itself). Using "End" terminates everything
and dumps everything from memory and completely stops execution. For
example, use

Private Sub btnFinish_Click()
Me.Hide
End Sub

Do NOT use

Private Sub btnFinish_Click()
End
End Sub

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Sat, 14 Mar 2009 11:08:21 -0600, Salgud
wrote:

Thanks for your reply. My response inline:

Chip Pearson wrote:
The problem is with the line

frmFacil.Show


This shows the form "modally", which means that code execution halts
in the main procedure until the form is hidden or unloaded. Code
within the form itself will run, but the line after the Show method
will not run until the form is dismissed.


That's exactly what I thought and what I want, but it's not running
after I click "Next" or "Finish".


You can show the form "modelessly", in which case the form will be
shown but code execution will continue on once the form is shown.


That's not what I want, at least not if I'm interpreting it correctly. I
want to halt execution while the user inputs the data, then continue
after they click "Next" or "Finish". I've used userforms before and not
had to use "Modeless", so why is that the case here? I'll give it a try
Monday when I get back to the office, but I'm not sure this is what I
want. Is there another way to get the macro to continue after the user
inputs the data? What would happen if I dismissed the form in the form
code, rather than after I return to the module?