![]() |
UserForm.Show error
I have a series of userforms set up so when I click on the "Next" button on
one, it closes, and the next userform opens. While I was tweaking some of the code, the userform.show command stopped working. When I click on "Next" I get Run-Time Error 438: Object doesn't support this property or method. When I click on debug, the line UserForm3.Show is highlighted. Here is my code: Private Sub cmdNext_Click() ' Do some stuff with the info on the form Unload Me UserForm3.Show End Sub |
UserForm.Show error
Try switching the unload and show lines like:
Private Sub cmdNext_Click() ' Do some stuff with the info on the form UserForm3.Show Unload Me End Sub "Horatio J. Bilge, Jr." wrote: I have a series of userforms set up so when I click on the "Next" button on one, it closes, and the next userform opens. While I was tweaking some of the code, the userform.show command stopped working. When I click on "Next" I get Run-Time Error 438: Object doesn't support this property or method. When I click on debug, the line UserForm3.Show is highlighted. Here is my code: Private Sub cmdNext_Click() ' Do some stuff with the info on the form Unload Me UserForm3.Show End Sub |
UserForm.Show error
I tried that, but it didn't make any difference.
"JLGWhiz" wrote: Try switching the unload and show lines like: Private Sub cmdNext_Click() ' Do some stuff with the info on the form UserForm3.Show Unload Me End Sub "Horatio J. Bilge, Jr." wrote: I have a series of userforms set up so when I click on the "Next" button on one, it closes, and the next userform opens. While I was tweaking some of the code, the userform.show command stopped working. When I click on "Next" I get Run-Time Error 438: Object doesn't support this property or method. When I click on debug, the line UserForm3.Show is highlighted. Here is my code: Private Sub cmdNext_Click() ' Do some stuff with the info on the form Unload Me UserForm3.Show End Sub |
UserForm.Show error
Okay, I feel stupid.
After lots more testing, I tracked it down to 2 If statements in the UserForm_Initialize sub on UserForm3. I commented out each line one at a time, and found that there was one line in each If statement that it didn't like. I took one of the lines out, and it worked fine. I put the line back in, and it still worked fine. I compared the line I added back in with the other bad line that I still had commented out, and discovered that I spelled "Bold" with an "F" (fold). It's working good now. "Horatio J. Bilge, Jr." wrote: I have a series of userforms set up so when I click on the "Next" button on one, it closes, and the next userform opens. While I was tweaking some of the code, the userform.show command stopped working. When I click on "Next" I get Run-Time Error 438: Object doesn't support this property or method. When I click on debug, the line UserForm3.Show is highlighted. Here is my code: Private Sub cmdNext_Click() ' Do some stuff with the info on the form Unload Me UserForm3.Show End Sub |
UserForm.Show error
Maybe...
Private Sub cmdNext_Click() ' Do some stuff with the info on the form me.hide UserForm3.Show Unload Me End Sub Make sure you didn't use UserForm3 as any other variable name, too. Horatio J. Bilge, Jr. wrote: I have a series of userforms set up so when I click on the "Next" button on one, it closes, and the next userform opens. While I was tweaking some of the code, the userform.show command stopped working. When I click on "Next" I get Run-Time Error 438: Object doesn't support this property or method. When I click on debug, the line UserForm3.Show is highlighted. Here is my code: Private Sub cmdNext_Click() ' Do some stuff with the info on the form Unload Me UserForm3.Show End Sub -- Dave Peterson |
UserForm.Show error
Glad you found it Horatio. The reason I suggested switching the two lines
was on the theory that like closing a workbook containing the code before the procedure has completed will stop the code, I thought it might apply to the UF as well. Since I always unload my UF from the parent procedure, I had never had the problem. "Horatio J. Bilge, Jr." wrote: Okay, I feel stupid. After lots more testing, I tracked it down to 2 If statements in the UserForm_Initialize sub on UserForm3. I commented out each line one at a time, and found that there was one line in each If statement that it didn't like. I took one of the lines out, and it worked fine. I put the line back in, and it still worked fine. I compared the line I added back in with the other bad line that I still had commented out, and discovered that I spelled "Bold" with an "F" (fold). It's working good now. "Horatio J. Bilge, Jr." wrote: I have a series of userforms set up so when I click on the "Next" button on one, it closes, and the next userform opens. While I was tweaking some of the code, the userform.show command stopped working. When I click on "Next" I get Run-Time Error 438: Object doesn't support this property or method. When I click on debug, the line UserForm3.Show is highlighted. Here is my code: Private Sub cmdNext_Click() ' Do some stuff with the info on the form Unload Me UserForm3.Show End Sub |
UserForm.Show error
You could have saved yourself a great deal of time and effort by changing
the Error Handler setting in the Options dialog in the VBA editor from "Break On Unhandled Errors" to "Break In Class Module". With the setting on "Class Module", the debugger would have taken you directly to the offending line of code rather than the Show statement, which loads the form into memory (if necessary) and runs the Initialize event, and it is in the Initialize event actually occurred. -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Horatio J. Bilge, Jr." wrote in message ... Okay, I feel stupid. After lots more testing, I tracked it down to 2 If statements in the UserForm_Initialize sub on UserForm3. I commented out each line one at a time, and found that there was one line in each If statement that it didn't like. I took one of the lines out, and it worked fine. I put the line back in, and it still worked fine. I compared the line I added back in with the other bad line that I still had commented out, and discovered that I spelled "Bold" with an "F" (fold). It's working good now. "Horatio J. Bilge, Jr." wrote: I have a series of userforms set up so when I click on the "Next" button on one, it closes, and the next userform opens. While I was tweaking some of the code, the userform.show command stopped working. When I click on "Next" I get Run-Time Error 438: Object doesn't support this property or method. When I click on debug, the line UserForm3.Show is highlighted. Here is my code: Private Sub cmdNext_Click() ' Do some stuff with the info on the form Unload Me UserForm3.Show End Sub |
UserForm.Show error
That's good to know. Thanks for the advice.
"Chip Pearson" wrote: You could have saved yourself a great deal of time and effort by changing the Error Handler setting in the Options dialog in the VBA editor from "Break On Unhandled Errors" to "Break In Class Module". With the setting on "Class Module", the debugger would have taken you directly to the offending line of code rather than the Show statement, which loads the form into memory (if necessary) and runs the Initialize event, and it is in the Initialize event actually occurred. -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Horatio J. Bilge, Jr." wrote in message ... Okay, I feel stupid. After lots more testing, I tracked it down to 2 If statements in the UserForm_Initialize sub on UserForm3. I commented out each line one at a time, and found that there was one line in each If statement that it didn't like. I took one of the lines out, and it worked fine. I put the line back in, and it still worked fine. I compared the line I added back in with the other bad line that I still had commented out, and discovered that I spelled "Bold" with an "F" (fold). It's working good now. "Horatio J. Bilge, Jr." wrote: I have a series of userforms set up so when I click on the "Next" button on one, it closes, and the next userform opens. While I was tweaking some of the code, the userform.show command stopped working. When I click on "Next" I get Run-Time Error 438: Object doesn't support this property or method. When I click on debug, the line UserForm3.Show is highlighted. Here is my code: Private Sub cmdNext_Click() ' Do some stuff with the info on the form Unload Me UserForm3.Show End Sub |
All times are GMT +1. The time now is 04:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com