ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   UserForm (https://www.excelbanter.com/excel-programming/304175-userform.html)

brad

UserForm
 
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

Dick Kusleika[_3_]

UserForm
 
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?

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Brad" wrote in message
...
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




No Name

UserForm
 
Yes it is in the AfterUpdate event of a combo box on the
form.

Brad
-----Original Message-----
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?

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Brad" wrote in

message
...
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



.


Dick Kusleika[_3_]

UserForm
 
Brad

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

--
Dick Kusleika
MVP - Excel Blog - Daily Dose of Excel
www.dicks-blog.com

wrote in message
...
Yes it is in the AfterUpdate event of a combo box on the
form.

Brad
-----Original Message-----
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?

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Brad" wrote in

message
...
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



.





All times are GMT +1. The time now is 06:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com