Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CommandButton not working on vbModeless Form

Status
Not open for further replies.

jpgactmod

Technical User
Feb 12, 2004
41
US
I have a UserForm named "TotYrReturnsForm" with a CommandButton named "CloseButton"

The form is run in a Sub named "Enter_5Yr_Averages"

Within the Sub "Enter_5Yr_Averages", I have the following line code:

TotYrReturnsForm.Show vbModeless

This line code opens the "TotYrReturnsForm" UserForm with the CommandButton named "CloseButton"

The "CloseButton" has the following code:
Public Sub CloseButton_Click()
Unload TotYrReturnsForm
End Sub

But when I click on the "CloseButton" on the opened "TotYrReturnsForm" UserForm, nothing happens (i.e. I cannot step into the "CloseButton_Click" Macro until the entire "Enter_5Yr_Averages" Sub is run).

Oddly (at least for me), when I open the "TotYrReturnsForm" with "TotYrReturnsForm.Show" versus "TotYrReturnsForm.Show vbModeless", the "CloseButton" works fine.

How can I get the "CloseButton" to work right after the "TotYrReturnsForm" UserForm is opened with "TotYrReturnsForm.Show vbModeless" versus waiting for the entire Sub to complete?
 
Thanks much for your suggestion. I have it working now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top