View Single Post
 
Old 11-28-2017, 03:28 PM
clynch28 clynch28 is offline Mac OS X Office 2016
Novice
 
Join Date: Nov 2017
Posts: 3
clynch28 is on a distinguished road
Default Run-Time Error 424

I'm writing code to access a userform and I am getting a run-time 424 object required error and I cannot figure out what is wrong with it. I'm attaching the code initializing the userform as well as the sub where I am having the issue.

Option Base 1

Public Type apartment
name As String
bed As Integer
bath As Integer
size As Integer
pool As Boolean
cable As Boolean
pet As Boolean
fitness As Boolean
rent As Currency
End Type


Sub loadData()

Dim txtFile As String
Dim dataLine As String
Dim row As Integer, column As Integer
Dim arrayForOneLine() As String


txtFile = ThisWorkbook.Path & "/data.txt"
Open txtFile For Input As #1


Do Until EOF(1)
Line Input #1, dataLine
arrayForOneLine = Split(dataLine, vbTab)
row = row + 1
ReDim apartmentArray(row)

apartment.name = arrayForOneLine(0)
apartment.bed = arrayForOneLine(1)
apartment.bath = arrayForOneLine(2)
apartment.size = arrayForOneLine(3)
apartment.pool = arrayForOneLine(4)
apartment.cable = arrayForOneLine(5)
apartment.pet = arrayForOneLine(6)
apartment.fitness = arrayForOneLine(7)
apartment.rent = arrayForOneLine(8)


Loop
Close #1

End Sub

Private Sub UserForm_Initialize()

bedComboBox.Style = fmStyleDropDownList
bathComboBox.Style = fmStyleDropDownList
sizeComboBox.Style = fmStyleDropDownList

With bedComboBox
.AddItem "1"
.AddItem "2"
.AddItem "3"
.AddItem "4"
End With

With bathComboBox
.AddItem "1"
.AddItem "2"
.AddItem "3"
End With

With sizeComboBox
.AddItem "less than 500 sf"
.AddItem "501-1000 sf"
.AddItem "1001-1500 sf"
.AddItem "1501-2000 sf"
.AddItem "more than 2000 sf"
End With

With Page3
OptionButton1.Value = True
End With

Page1.Select

End Sub
Reply With Quote