Object required

gmazza76

Well-known Member
Joined
Mar 19, 2011
Messages
771
Office Version
  1. 365
Platform
  1. Windows
Good Evening,

I am using the VB below to load a userform that has stats on for an ongoing project that is being run at work.

The only thing is i dont understand the "Object Required" error.
As far as i can tell i only have 1 if statement that is closed with an end if then an End Sub at the end.

All help appreciated
Thanks
Gavin

Code:
Private Sub cmdsubmit_Click()
'Open file
Workbooks.Open Filename:="C:\Users\MAZZA\Documents\Gavin\Car Park\FYVData.xls" 'Home
Dim myBook As Workbook
 
On Error Resume Next
Set myBook = Application.Workbooks("FYVData.xls")
On Error GoTo 0
    
'If Laura Haynes - Call Centre Enquiry
Dim ws As Worksheet
Set ws = Worksheets("Breakdown Stats")
If Outstanding.ComboBox1 = "Laura Haynes" Then
Pword = InputBox("Please enter password")
    If Pword = "ticket" Then
            ActiveWorkbook.Sheets("Breakdown Stats").Activate
        Else
            MsgBox "Please contact your administrator for a password"
            Workbooks("FYVData.xls").Close True
        Exit Sub
    End If
            'OverviewL name of Form to load
            OverviewL.Show
            OverviewL.TextBox1.Value = ws.Range("C3").Value 'Abdul - Created
            OverviewL.TextBox18.Value = ws.Range("D3").Value 'Abdul - Closed
            OverviewL.TextBox19.Value = ws.Range("E3").Value 'Abdul - o/s
            OverviewL.TextBox7.Value = ws.Range("c4").Value  'Christopher - C
            OverviewL.TextBox17.Value = ws.Range("D4").Value 'Christopher - W
            OverviewL.TextBox27.Value = ws.Range("E4").Value 'Christopher - O

End If
End Sub
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Is OverviewL the name of a userform? If so, in what workbook?
 
Upvote 0
OverviewL is the name of the userform.

All userforms are loaded from the main workbook "FYV Car Park.xls" and the data is then brought in from "FYVData.xls"

Hope this helps
 
Upvote 0
There will be 1 (or more) errors in the code for the userform itself, most probably the Userform_Initialize event for that userform.
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,710
Members
452,939
Latest member
WCrawford

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