UserForm Problem

K_Man95

Board Regular
Joined
Jul 31, 2002
Messages
158
I have a User Form that I am trying to open with a button click. I made a copy of one workbook with a new name. The Buttons and Macros were all copied as well. I modified the old Userform so that I can release Version 2 of the Userform, and now when I click on the button in Excel, I get the following error : Object doesn't support this property or method. Run-Time error '438'.

The code assigned to that button is as follows:

Sub Button121_Click()
'
' Button121_Click Macro
' Macro recorded 8/11/2002 by Kale Mayfield

'
UserForm1.Show

End Sub

What am I doing wrong? HELP!!!!!!!!! Once you have the Userform populated with ComboBoxes,Textboxes, etc., is there now way of making changes to that Userform? If you make changes and rearrange the locations of the buttons and boxes and labels... does that mess up the button in Excel that opens the form to begin with?

HELP!!
This message was edited by K_Man95 on 2002-11-07 21:23
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
To open (call) a UserForm you should have the call macro in a module. The macro should be something like this, assuming that the Userform is named: UserForm1.

Sub CommandButton1_Click()
Userform1.Show
End Sub

Hope this helps....
 
Upvote 0
Re: HELP!! UserForm Problem

Pardon my bumping of a a seven-year old topic, but I'm actually encountering something fairly similar to this guy's problem from way back when:


I have a UserForm named CMoverhaul_minor and in Module10, I have the following code:

Code:
Sub PerformMinor()
  
    CMoverhaul_minor.Show
    
End Sub

And yes, I get a 'Runtime error 438' telling me that the object doesn't support this property or method....

The error always breaks on the CMoverhaul_minor.Show portion of the code, so I assume that none of the code in the form itself affects that. But what could it be? I have other forms in this workbook that I have no problem showing with the identical syntax.

So I guess the question is, if the form exists and the code to show the form is in a Module, what else could possibly cause this error??
 
Upvote 0
Re: HELP!! UserForm Problem

Pardon my bumping of a a seven-year old topic, but I'm actually encountering something fairly similar to this guy's problem from way back when:


I have a UserForm named CMoverhaul_minor and in Module10, I have the following code:

Code:
Sub PerformMinor()
 
    CMoverhaul_minor.Show
 
End Sub

And yes, I get a 'Runtime error 438' telling me that the object doesn't support this property or method....

The error always breaks on the CMoverhaul_minor.Show portion of the code, so I assume that none of the code in the form itself affects that. But what could it be? I have other forms in this workbook that I have no problem showing with the identical syntax.

So I guess the question is, if the form exists and the code to show the form is in a Module, what else could possibly cause this error??
Have you checked to make sure that the spelling is correct with same name as User Form
 
Upvote 0
Yes. I've renamed it to several simpler names as well in the hopes that would fix that problem, but it doesn't seem to matter what it's called.

Only this form is causing the error, even though the code for calling all the other forms is the same, so I have no idea and am running out ways to troubleshoot the problem...
 
Upvote 0
Aha! Solved

It turns out the code within the form itself DOES prevent it from being called in the first place:

Code:
Private Sub UserForm_Initialize()

I had this built into the form itself to set its default values, but really it should read:

Code:
Private Sub CMoverhaul_major_Initialize()

in order to match the proper name of the form.

It's a miracle that I haven't run into this problem before....in fact, it makes me question how I may have screwed up previous macros. In any case, it's resolved!
 
Upvote 0
Re: Double posting because I have no choice.

Randall

This is not correct.
Code:
Private Sub CMoverhaul_major_Initialize()
This is.
Code:
Private Sub UserForm_Initialize()
If you are having problems showing a userform then the problem might actually be in the code behind it.

I know it's annoying but VBA just works that way.

If there is a problem with code in the userform when you try to show it the only line highlighted is usually the the one used to show it.

A possible answer is to goto Tools>Options... and on the General tab select Break On All Errors in the Error Trapping section.

Like I say annoying but hopefully when you change that setting, if the error is in the code behind the form, you'll be taken to the line causing the problem.:)

PS Regarding the ability to edit posts, I don't think the 10 minute thing is too harsh and I don't think it has anything to do with spam.

Also it might actually be better to post again rather than editing.
 
Upvote 0
Re: Double posting because I have no choice.

Randall

This is not correct.
Code:
Private Sub CMoverhaul_major_Initialize()
This is.
Code:
Private Sub UserForm_Initialize()

Yes, I know, that's what I was trying to say before my attempt to post again was deleted for objecting to the rules.

Thanks for the feedback! I'll toy around with some of those error trapping things throughout the day here and return with results.
 
Upvote 0
Re: HELP!! UserForm Problem

Yikes--yes, it turns out it was a typo in the UserForm_Initialize code!

"ActiveCell.Offest" -- oops. It's always unsettling when you waste about six hours over two days on one lousy character. :)

Thanks again!
 
Upvote 0
Re: HELP!! UserForm Problem

Try going to Debug>Compile before running the code.
 
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top