Seriously VBA, what the hell? (Calling Userforms)

bonzodog1990

New Member
Joined
Aug 26, 2011
Messages
14
Hi All,

This is making me tear my hair out, please tell me what I'm missing!

I have this, very simple, code:

Private Sub BondButton_Click()
Rows("2:2").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
SelectTradeType.Hide
EnterABond01.Show

End Sub
Private Sub IRSButton_Click()
Rows("2:2").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove

SelectTradeType.Hide
EnterAnIrs.Show

Two buttons on userform that call other userforms, no problems, except the bottom one works to call 'EnterAnIrs' and the top one 'EnterABond01' just doesn't. I've tried all kinds of names for the 'EnterABond01' userform, and nothing works. I just get the error msg:

'Object doesn't support this property or method'

Can you please give me a list of things to check/reasons this might be happening?

Many thanks,

Ben
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Re: Seriously VBA, what the @#!*% ? (Calling Userforms)

It sounds to me like your "EnterAnIrs" and "EnterABond01" are both forms that the code wants to display when run.

If the one is working, and the other isn't, than the "bond" form is either named something different or doesn't exist.

Look in your code editor under the Forms section and make sure the Bond form is there and named correctly.
 
Upvote 0
Re: Seriously VBA, what the @#!*% ? (Calling Userforms)

Can you run that form from anywhere? I'd start by checking the Initialize or Activate event code of the form.
 
Upvote 0
The form is definitely there, definitely named correctly, as in i copied and pasted the name rather than re-typing it.

the line to show the userform generates the error message no matter where you put it.
 
Upvote 0
And the really weird thing, VBA autofills the name as I start typing, as in if I type the first few letters of the name it autocompletes the rest, and THEN tells me it isn't an object! No fair.
 
Upvote 0
What am I looking for there? The initialize section of code on the form I'm trying to call just has some code to get suggested values into some comboboxes, no declarations about the form or anything that might screw things up.

There's nothing in the 'initialize' section for the code above.
 
Upvote 0
Ah, you are right however that the problem is with the initialize code. trying to break through it and work out what it doesn't like...
 
Upvote 0
If you post it, we may be able to help. Alternatively, run the form, when the error occurs, press f8 repeatedly to step through the code until you hit the real error line.
 
Upvote 0
Found the problem. I'd forgotten to change the name on one of the comboboxes.

Very irritating, and thanks for the very obvious and sensible suggestion which I probably never would have thought to do :laugh:
 
Upvote 0

Forum statistics

Threads
1,224,545
Messages
6,179,432
Members
452,915
Latest member
hannnahheileen

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