UserForm

B

Brad

Thanks for taking the time to read my question.

I have a form that I use for data entry.

I have several buttons on it through which I can close
the form using the Unload UserForm3 statement.

I have an AfterUpdate event on an combobox that says that
if criteria are met, run some functions, display a
message, and close the form.

This causes me problems because the code returns to the
line that loaded the form instead of the line after and
then the error occurs. I've tried error handling for
that specific error, but it doesn't help.

The error I recieve is:

- - - - - - - - - - - - - - -
Run-time error '-2147417848(80010108)'

Automation Error
The object invoked has disconnected from its clients.
- - - - - - - - - - - - - - -

If I end the code and return to the worksheet manually, I
can select cells with my mouse but can't do anything with
my keyboard. I can close the workbook, but not Excel. I
have to do a Ctrl+Alt+Del and End Process on Excel.

How do I close this UserForm with out getting this error?

Here is my code that loads the User Form:

- - - - - - - - - - -
If ActiveCell.Column = 8 And ActiveCell.Row > 20 And
ActiveCell.Row < 65 Then
Load UserForm3
UserForm3.Show 'this is where the error occurs after
the code runs for closing the User Form. The code stops
here and you cannot F8 past it or anything.
End If
- - - - - - - - - - -

Here is my code that closes the User Form

- - - - - - - - - - -
If x < Sheets("Code").Range("W3") And Me.TextBox2.Text
<> "N/A" Then
DontRunThroughFlockSheetSelectionChange = True
'Unload UserForm3
Sheets("Flock Sheet").Cells(ActiveCell.Row,
ActiveCell.Column + 5).Select
UpdateFeedRequirements
MsgBox "Feed Requirements have been updated, and the
next stage should now be delivered.", 64
DontRunThroughFlockSheetSelectionChange = False
Unload UserForm3
Else
Me.CommandButton2.SetFocus
End If
- - - - - - - - - - -

Thanks so much for the help.

Brad
 
D

Dick Kusleika

Brad

First, download the Code Cleaner utility from http://www.appspro.com/. That
will usually solve the problem. If it doesn't, then where is the code that
closes the form? In the AfterUpdate event?
 
D

Dick Kusleika

Brad

Does that mean Code Cleaner didn't fix it. You may be stuck recreating the
workbook.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top