0

I have a Corel Draw issue using Exit Sub to close a Userform after clicking a button.

It will run the script to completion, but won't execute the Exit Sub command.

enter image description here

I tried setting a dummy variable to a true value If X=1 then Exit Sub but that didn't do the trick either.

Private Sub CommandButton1_Click() MsgBox "Script Ran!" Exit Sub End Sub 

My hope is to click a button, and have the userform close after it runs. My impression was Exit Sub is the way to do this.

1 Answer 1

1

Exit Sub functions as an exit point of the current Sub.
Having it before End Sub does literally nothing except leaving the Sub one line earlier.

What you want is Unload Me.
See the relevant VBA documentation of the Unload Statement.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.