userform error 424

dwagner3210

New Member
Joined
May 20, 2013
Messages
9
I am pretty much a newb re macros. I have a client who has asked me to troubleshoot a macro that was working for a long time. the PC crashed and now the macro does not. I helped them resolve some reference issues when they reloaded the OS. However, they now have a runtime error 424 object required that keeps coming up. It highlights the subroutine bolded at end of this code. I have tried renaming the userform but to no avail. It is running on winxp sp3. Here is code from the module. not even sure if that is what someone needs to troubleshoot. Any suggestions?
Rich (BB code):
Private Sub DoEvent()
    UserForm1.DoEvent ' This is called when timer event fires
End Sub
   
Sub LoadData()
'
' ups Macro
' Macro recorded 11/4/2003 by L Flowers
' Keyboard Shortcut: Ctrl+r
'
' Modified by JLW: Added the following functionality:
'   Barcode and Scale Reading capability, and modularized it for more than one PC.
    Dim CSVFile As String
   
    Columns("A:A").EntireColumn.AutoFit
    Range("A250").Select
    ActiveWindow.ScrollRow = 1
    
    'Prior to loading data, sort the scanned information
    Columns("A:G").Select
    Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _
        OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
    
    ' Now looks for txt.csv in the same folder as the spreadsheet
    CSVFile = VBAProject.ThisWorkbook.Path & "\txt.csv"
    
    On Error GoTo NoCSVFile 'If we can't load the UPS csv data file, let user know why!
    With ActiveSheet.QueryTables.Add(Connection:= _
        "TEXT;" & CSVFile, Destination _
        :=Range("E1"))
        .Name = "txt"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .TextFilePromptOnRefresh = False
        .TextFilePlatform = xlWindows
        .TextFileStartRow = 1
        .TextFileParseType = xlDelimited
        .TextFileTextQualifier = xlTextQualifierDoubleQuote
        .TextFileConsecutiveDelimiter = False
        .TextFileTabDelimiter = False
        .TextFileSemicolonDelimiter = False
        .TextFileCommaDelimiter = True
        .TextFileSpaceDelimiter = False
        .TextFileColumnDataTypes = Array(9, 9, 9, 9, 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, _
        9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9)
        .Refresh BackgroundQuery:=False
    End With
    Range("E1").Select
    Selection.ClearContents
    CurrentRow = 1
    Columns("E:E").Select
    Selection.Sort Key1:=Range("E1"), Order1:=xlAscending, Header:=xlGuess, _
        OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
    Columns("F:F").Select
    Selection.NumberFormat = "General"
    Range("F1").Select
    ActiveCell.FormulaR1C1 = "=RC[-5]=RC[-1]"
    Range("F1").Select
    Selection.Copy
    Range("F2:F1000").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ' Put focus back on originating cell
    Range("A1").Select
    Exit Sub
    
NoCSVFile:
    MsgBox "The UPS Data file was not found in the same folder as this spreadsheet. Please ensure that it does.", , "UPS CSV Data File Missing"
    Exit Sub
    
End Sub
Sub ScaleReader()
    UserForm1.Show
    
End Sub
 
Last edited by a moderator:
In the VB Editor, under Tools-Options, on the Editor tab, do you have the 'Auto List Members' option checked? If so, you should get a list of available properties of the form as soon as you typed the period after Me

At any rate it would appear unlikely that the control is there. If you select Tools-References in the VB Editor, can you see a reference to the COMMS library? If so, does it have 'MISSING:' in front of it?

Ok some further clarifications. When the client types Me. on the sheet at their site it comes up with a windows to select active x controls. They are sending me screen shots to verify it is the windows you were expecting. Also when looking at the tools references MSCOMM is there and no missing in front of it. I also had them use regsvr32 MSCOMM32.ocx to make sure it was registered.

Had them try macro again on their side and it still comes up with error 424. when they f8 from that error screen it goes to the userform intialization line of the code.

any further advice?? I am also working on getting myself remote access to this machine to speed my troubleshooting of this in the actual environment instead of my ad hoc one. Thanks for all the help to this point. I feel like we are right there and that something when they reset this machine was missed. PS also had them verify the serial port was COM1.
 
Upvote 0

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
In the VB Editor, under Tools-Options, on the Editor tab, do you have the 'Auto List Members' option checked? If so, you should get a list of available properties of the form as soon as you typed the period after Me

At any rate it would appear unlikely that the control is there. If you select Tools-References in the VB Editor, can you see a reference to the COMMS library? If so, does it have 'MISSING:' in front of it?

Ok some further clarifications. When the client types Me.on the sheet at their site it comes up with a windows to select active xcontrols. They are sending me screen shots to verify it is the windows you wereexpecting. Also when looking at the tools references MSCOMM is there and nomissing in front of it. I also had them use regsvr32 MSCOMM32.ocx to make sure it was registered.

Had them try macro again on their side and it still comes up with error 424.when they f8 from that error screen it goes to the userform intialization lineof the code.

any further advice?? I am also working on getting myself remote access to thismachine to speed my troubleshooting of this in the actual environment insteadof my ad hoc one. Thanks for all the help to this point. I feel like we areright there and that something when they reset this machine was missed. PS alsohad them verify the serial port was COM1.
<o:p></o:p>
 
Upvote 0
Once they f8 to the Initialize code have them keep pressing f8 until an error occurs then tell you which line it is.

Do they see MSComm1 listed when they type Me. in the code?
 
Upvote 0
Ok i finally got access to machine and just brought in code from a working sheet. Now the form comes up and appears to work. Who knows who touched the template they are using. But at least getting past the pervious point.

It works until it gets to where it has to grab a reading form the scale. It errors out saying it is getting an invalid code from scale. I did a breakpoint right after read to get value of the input and it appears to be "". so guesing there is some communication protocol difference. It looks like COM1 is set to 9600,e,7,1 which appears to be what the code is expecting. Any other easy blunders people make when setting up serial communication that may be preventing values from reaching the code?

I will do some research but thanks helping me get to this point.
 
Upvote 0
Serial comms is not my forte I'm afraid.
 
Upvote 0
mine either obviously ! Thank you so much for helping me to this point. I did grab the userform that did not work and one that did i will compare and see if i see any differences and report back to here.

Thank you again.
 
Upvote 0

Forum statistics

Threads
1,216,031
Messages
6,128,424
Members
449,450
Latest member
gunars

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