Object Required Error - User Forms - Complete Newbie!

leighjones123

New Member
Joined
Aug 12, 2011
Messages
49
Office Version
  1. 365
Platform
  1. MacOS
Hi All

Very much a newbie at this and this is my first VB Project for Work.

Wonder if anyone could help me...

I keep getting a Run time 404 - object required message.

I've played around and cannot work it out..

This is my Module to open my form...
Code:
Sub OpenNewRequest()
    frmNewRequest.Show
End Sub

This is my user form code..

Code:
Private Sub cmdCancel_Click()
    Unload Me
End Sub
Private Sub cmdClearForm_Click()
    Call UserForm_Initialize
End Sub
Private Sub cmdOK_Click()
    ActiveWorkbook.Sheets("Raw Data").Activate
    Range("B2").Select
    Do
    If IsEmpty(ActiveCell) = False Then
        ActiveCell.Offset(1, 0).Select
    End If
    Loop Until IsEmpty(ActiveCell) = True
    ActiveCell.Value = txtName.Value
    ActiveCell.Offset(0, 1) = txtEmail.Value
    ActiveCell.Offset(0, 2) = cboDepartment.Value
    ActiveCell.Offset(0, 3) = cboRequesttype.Value
    ActiveCell.Offset(0, 4) = txtCTN.Value
    ActiveCell.Offset(0, 5) = txtDateTime.Value
    ActiveCell.Offset(0, 6) = txtAgent.Value
    ActiveCell.Offset(0, 7) = txtDetail.Value
    ActiveCell.Offset(0, 8) = txtCost.Value
    ActiveCell.Offset(0, 9) = Now()
 
    Sheets("Sheet3").Select
    Unload Me
  frmConfirmSubmit.Show
 
  End Sub
 
 
Private Sub txtPhone_Change()
End Sub
Private Sub UserForm_Initialize()
    txtName.Value = ""
    txtPhone.Value = ""
    With cboDepartment
        .AddItem "TSC Warrington"
        .AddItem "TSC Kilmarnock"
        .AddItem "TSC Dearne Valley"
        .AddItem "Stoke"
        .AddItem "Newark"
        .AddItem "Egypt"
        .AddItem "LBM"
    End With
    cboDepartment.Value = ""
    With cboCourse
        .AddItem "Advisor Feedback"
        .AddItem "Call Listening Request"
        .AddItem "Process Feedback"
    End With
    cboCourse.Value = ""
    optIntroduction = True
    chkLunch = False
    chkVegetarian = False
    txtName.SetFocus
End Sub


When i get the error and i click Debug, it highlights:

Code:
Sub OpenNewRequest()
[B][COLOR=sandybrown]    frmNewRequest.Show[/COLOR][/B]
End Sub


Could anyone please help? I'd be so appreciative!!

Thanks,

Leigh
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
When you get the error, press debug, then press f8 repeatedly until you hit the actual error line. I suspect one of the control names is wrong.
 
Upvote 0
Thanks for your advice.

I've somehow fixed that Object Required error, it will now display the form when clicked.

The only new problem i'm up against is that none of the drop own options i have entered will display when I click it.

I've checked the code and the options are all in there.

I don't get any errors, it just doesnt display :(

Could anyone please help me with this one?

Updated Code:
Code:
Private Sub cmdCancel_Click()
    Unload Me
End Sub
Private Sub cmdOK_Click()
    ActiveWorkbook.Sheets("Raw Data").Activate
    Range("B2").Select
    Do
    If IsEmpty(ActiveCell) = False Then
        ActiveCell.Offset(1, 0).Select
    End If
    Loop Until IsEmpty(ActiveCell) = True
    ActiveCell.Value = txtName.Value
    ActiveCell.Offset(0, 1) = txtEmail.Value
    ActiveCell.Offset(0, 2) = cboDepartment.Value
    ActiveCell.Offset(0, 3) = cboRequesttype.Value
    ActiveCell.Offset(0, 4) = txtCTN.Value
    ActiveCell.Offset(0, 5) = txtDateTime.Value
    ActiveCell.Offset(0, 6) = txtAgent.Value
    ActiveCell.Offset(0, 7) = txtDetail.Value
    ActiveCell.Offset(0, 8) = txtCost.Value
    ActiveCell.Offset(0, 9) = Now()
    
    Sheets("Sheet3").Select
    Unload Me
  frmConfirmSubmit.Show
   
  End Sub
Private Sub txtPhone_Change()
End Sub
Private Sub frmNewRequest()
    txtName.Value = "hello"
    txtPhone.Value = ""
    With cboDepartment
        .AddItem "TSC Warrington"
        .AddItem "TSC Kilmarnock"
        .AddItem "TSC Dearne Valley"
        .AddItem "Stoke"
        .AddItem "Newark"
        .AddItem "Egypt"
        .AddItem "LBM"
    End With
    cboDepartment.Value = ""
    With cboRequesttype
        .AddItem "Advisor Feedback"
        .AddItem "Call Listening Request"
        .AddItem "Process Feedback"
    End With
    cboCourse.Value = ""
    optIntroduction = True
    chkLunch = False
    chkVegetarian = False
    txtName.SetFocus
End Sub
 
Upvote 0
You should not have renamed that sub, since the code is now not being run when you load the form.
 
Upvote 0
Oh No!

I really havn't got a clue what i'm doing to be honest but i'm trying to learn! haha!

How can i resolve this issue?

I think it was my rename which took away that Object Required Error, because when i try to change it back, the same error repeats?

Thanks
 
Upvote 0
To confirm, everything is working as it should do, when i've got the re-named Sub, apart from the drop down boxes
 
Upvote 0
Did you try what I suggested originally? The only reason your error has disappeared is because the code isn't running at all.
 
Upvote 0
Rorya

Yes, I did.

It highlighted each of these rows in turn

Code:
Private Sub UserForm_Initialize()
    txtName.Value = ""
    txtPhone.Value = ""
    With cboDepartment
        .AddItem "TSC Kilmarnock"
        .AddItem "TSC Dearne Valley"
        .AddItem "Stoke"
        .AddItem "Newark"
        .AddItem "Egypt"
        .AddItem "LBM"
    End With
    cboDepartment.Value = ""
    With cboRequesttype
        .AddItem "Advisor Feedback"

I'm unsure as to what this means - does this mean the error is on the final line?

Thanks so much for taking the time to help

Leigh
 
Upvote 0
Which line actually caused the final error? Have you double checked the control names? (if you type 'Me.' (without the quotes) in front of the control names, do they match the items in the list you should see?
 
Upvote 0

Forum statistics

Threads
1,224,548
Messages
6,179,445
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