#1
|
|||
|
|||
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 |
#2
|
|||
|
|||
.
Please be specific which line is highlighted when you receive the error message. Otherwise, it will be searching for a pin in the proverbial haystack. Having said that, the last line raises an eyebrow Code:
Page1.Select Code:
Sheets("Sheet1").Activate Sheets("Sheet1").Range("A1").Select to SHOW MODAL = False |
#3
|
|||
|
|||
The error is on the line: apartment.name = arrayForOneLine(0) if that helps.
|
#4
|
|||
|
|||
.
Post your workbook for review. |
#5
|
|||
|
|||
Here it is
|
#6
|
|||
|
|||
.
I made a few changes to the macro code regarding the MultiPage Control .. specifically relating to the referencing of each of the three sheets. In the ResetButton_Click macro, edited this line: Code:
'Sets the OptionButton1 control as TRUE or selected upon opening. MultiPage1.Page3.OptionButton1 = True In UserForm_Initialize macro, edited this line : Code:
'Sets FOCUS to first page of multipage control when UserForm opens Me.MultiPage1.Value = 0 The LoadDate macro will need attention as well, reference how the Text file is opened and data retrieved. Always use the phrase OPTION EXPLICIT at the top of all modules before you begin entering code. It acts as an 'error checker', letting you know which lines have an error and providing an error code for you to review. Oftentimes, it will make completing your project occur in less time. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Run Time Error '1004' | galkej | Excel | 0 | 02-03-2014 06:39 AM |
Get Run-time Error 11 | Jamtart | PowerPoint | 2 | 08-31-2012 05:04 AM |
Run time error 1004 | yonasan | Excel Programming | 3 | 06-12-2012 11:08 PM |
Word Visual Basic error - run time error 504 | crazymorton | Word | 11 | 01-13-2012 04:32 AM |
Run-time error 438 | cksm4 | Word | 2 | 01-12-2011 03:41 PM |