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
 

DragonWood

Board Regular
Joined
Oct 17, 2010
Messages
97
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.
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
34,327
Office Version
365, 2019, 2016, 2010
Platform
Windows, MacOS
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.
 

bonzodog1990

New Member
Joined
Aug 26, 2011
Messages
14
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.
 

bonzodog1990

New Member
Joined
Aug 26, 2011
Messages
14
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.
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
34,327
Office Version
365, 2019, 2016, 2010
Platform
Windows, MacOS
Re: Seriously VBA, what the @#!*% ? (Calling Userforms)

I'd start by checking the Initialize or Activate event code of the form.
:)
 

bonzodog1990

New Member
Joined
Aug 26, 2011
Messages
14
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.
 

bonzodog1990

New Member
Joined
Aug 26, 2011
Messages
14
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...
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
34,327
Office Version
365, 2019, 2016, 2010
Platform
Windows, MacOS
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.
 

bonzodog1990

New Member
Joined
Aug 26, 2011
Messages
14
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 :LOL:
 

Forum statistics

Threads
1,081,835
Messages
5,361,600
Members
400,640
Latest member
fruitbros

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top