Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-28-2017, 03:28 PM
clynch28 clynch28 is offline Run-Time Error 424 Mac OS X Run-Time Error 424 Office 2016
Novice
Run-Time Error 424
 
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
  #2  
Old 11-28-2017, 04:29 PM
Logit Logit is online now Run-Time Error 424 Windows 10 Run-Time Error 424 Office 2007
Expert
 
Join Date: Jan 2017
Posts: 533
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

.
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
Wonder if it shouldn't be

Code:
Sheets("Sheet1").Activate
Sheets("Sheet1").Range("A1").Select
Also, if the UserForm is still displayed, you will need to set it's PROPERTIES setting
to SHOW MODAL = False
Reply With Quote
  #3  
Old 11-28-2017, 04:31 PM
clynch28 clynch28 is offline Run-Time Error 424 Mac OS X Run-Time Error 424 Office 2016
Novice
Run-Time Error 424
 
Join Date: Nov 2017
Posts: 3
clynch28 is on a distinguished road
Default

The error is on the line: apartment.name = arrayForOneLine(0) if that helps.
Reply With Quote
  #4  
Old 11-28-2017, 05:31 PM
Logit Logit is online now Run-Time Error 424 Windows 10 Run-Time Error 424 Office 2007
Expert
 
Join Date: Jan 2017
Posts: 533
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

.
Post your workbook for review.
Reply With Quote
  #5  
Old 11-28-2017, 05:34 PM
clynch28 clynch28 is offline Run-Time Error 424 Mac OS X Run-Time Error 424 Office 2016
Novice
Run-Time Error 424
 
Join Date: Nov 2017
Posts: 3
clynch28 is on a distinguished road
Default

Here it is
Attached Files
File Type: xlsm HW5_FP01_Chase_Lynch.xlsm (23.8 KB, 9 views)
Reply With Quote
  #6  
Old 11-28-2017, 08:59 PM
Logit Logit is online now Run-Time Error 424 Windows 10 Run-Time Error 424 Office 2007
Expert
 
Join Date: Jan 2017
Posts: 533
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

.
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 searchButton_Click() macro is not complete. It will need additional code.

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.
Attached Files
File Type: xlsm HW5_FP01_Chase_Lynch.xlsm (27.9 KB, 12 views)
Reply With Quote
Reply



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 424 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 424 Run-time error 438 cksm4 Word 2 01-12-2011 03:41 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:46 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft