CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Join Date
    Jun 2006
    Posts
    194

    Question Help: Run-time error '424' Object required

    I have this huge headache of an error message. When I run the project, I have no error message. However, when I create the executable & run it, the application runs, but when I press a button to open a particular form, I get: Run-time error '424' Object required

    I went back to my project and put MsgBox's where I call that form, and the problem is in the below function (the stars show the line it busts on):

    Code:
    Private Sub EnabledAndVisible()
       Dim Actions As New Collection
       Dim ActionsEx As New Collection
       Dim Action As Variant
       Dim Enab As Boolean
       Dim Vis As Boolean
    
       Actions.Add Array(D_CONST_GSS, TreeView1, TreeView1.nodes.Item("GSS"), frameGSS) 
       Actions.Add Array(D_CONST_GC, TreeView1, TreeView1.nodes.Item("GC"), frameGC)
       Actions.Add Array(D_CONST_PN, PPN, -1)
       Actions.Add Array(D_CONST_PL, PPL, -1)
       Actions.Add Array(D_CONST_AP, PAP, -1)
       Actions.Add Array(D_CONST_C11, TreeView1, TreeView1.nodes.Item("C11"), frameC11)
       
       ActionsEx.Add Array(D_CONST_M25, TreeView1, TreeView1.nodes.Item("M25"), frameM25)
       ActionsEx.Add Array(D_CONST_TP, TreeView1, TreeView1.nodes.Item("TP"), frameTP)
     
       For Each Action In Actions
          If UBound(Action) < 3 Then
             Vis = ((Action(0) And Present) <> 0)
             Enab = ((Action(0) And Authorized) <> 0)
          Else
             Vis = ((Action(0) And Present) = Action(0))
             Enab = ((Action(0) And Authorized) = Action(0))
          End If
          
          Select Case TypeName(Action(1))
             Case "TreeView"
                
                MsgBox frameGSS.Caption 'gets here
                
                If UBound(Action) >= 3 Then
                    
                    MsgBox TypeName(Action(3)) 'gets here
                    
                    Call DisableFrame((Action(3)), Enab) '******busts here
    
                End If
                
                MsgBox "7"    'doesn't not get here
                
                Call DisableTreeNode((Action(2)), Vis)
    
             Case "OptionButton", "CheckBox"
                Action(1).Visible = Vis
                Action(1).Enabled = Enab
             Case Else
                MsgBox TypeName(Action(1))
          End Select
       Next Action
       
       For Each Action In ActionsEx
          If UBound(Action) < 3 Then
             Vis = ((Action(0) And PresentEx) <> 0)
             Enab = ((Action(0) And AuthorizedEx) <> 0)
          Else
             Vis = ((Action(0) And PresentEx) = Action(0))
             Enab = ((Action(0) And AuthorizedEx) = Action(0))
          End If
          
          Select Case TypeName(Action(1))
             Case "TreeView"
                'Action(1).TabVisible(Action(2)) = Vis
                'Action(1).TabEnabled(Action(2)) = Enab
                Call DisableFrame((Action(3)), Enab)
                Call DisableTreeNode((Action(2)), Vis)
             Case "OptionButton", "CheckBox"
                Action(1).Visible = Vis
                Action(1).Enabled = Enab
             Case "Frame"
                Action(1).Visible = Vis
                Action(1).Enabled = Enab
             Case Else
                MsgBox TypeName(Action(1))
          End Select
       Next Action
    End Sub
    I've been searching for solutions to Run-time error message 424 for hours and have found nothing relevant. I do not have a database being accessed anywhere....nor any functionality with Outlook, Access, or Excel. Any help is greatly appreciated!!!!!!!

  2. #2
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Help: Run-time error '424' Object required

    Have you put msgboxes in the disableframe to trace what's happening in that module. it's posible that this module is one caussing the error...

    If posible post that module or your project and we can check it out for you..

    Gremmy....
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  3. #3
    Join Date
    Jun 2006
    Posts
    194

    Re: Help: Run-time error '424' Object required

    Code:
    Private Sub DisableFrame(theFrame As Frame, Enab As Boolean) 
    Dim Ctl As Control
      
    MsgBox "aa"   'does not even get to this msgbox
      
      On Error Resume Next
      
      For Each Ctl In Me.Controls
        If Ctl.Container Is theFrame Then
           If TypeOf Ctl Is Frame Then DisableFrame Ctl, Enab
           Ctl.Enabled = Enab
        End If
      Next
      theFrame.Enabled = Enab
    End Sub

  4. #4
    Join Date
    Jun 2006
    Posts
    194

    Re: Help: Run-time error '424' Object required

    I FOUND A SOLUTION!!!

    When I go to make the project, I select Options... and under the Compile tab, I changed it from: Compile to Native Code to Compile to P-Code.

    NOW, my question is, what are the differences between the two? How will this affect my application? like....is there a speed difference, etc, etc, etc...

    Thanks for the input!

  5. #5
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: Help: Run-time error '424' Object required

    The problem is here
    Code:
    Dim Action as Variant
     
    .....
    	MsgBox TypeName(Action(3)) 'gets here
     
    Call DisableFrame((Action(3)), Enab) '******busts here
    A Variant datatype is not necessarily an object but a frame is.
    So the function which has the input param 'theFrame as Frame' is awaiting to get an object here which is handled by Ref and so you maybe need to explicitely convert it before using the function like

    Code:
    Dim Action as Variant
    Dim myFrame as Frame
    .....
    	MsgBox TypeName(Action(3)) 'gets here
    ' Typeconvert the Variant now
    Set myFrame = Action(3) 	 
    Call DisableFrame(myFrame, Enab) ' should no longer beng a problem
    Hope this helps.
    Last edited by JonnyPoet; November 13th, 2007 at 06:06 PM. Reason: edited error shown by WoF
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  6. #6
    Join Date
    Jun 2007
    Posts
    2

    Re: Help: Run-time error '424' Object required

    hi all,
    i have developed this system which is working well in my previous VB installation. due to some problem, i have remove my VB and install it again. when i run the same system, it gave me the "Run time error '424' Object Required". when i debug it, it shows me this line of code:

    SikapG.Col = 1 --> this line of code
    SikapG.Row = 1
    SikapG.Text = rs1.Fields("Gender")

    the error is from my grid lines which suppose to display data from database. why is this error occurred? is it because of some missing component during the installation or what..

  7. #7
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Help: Run-time error '424' Object required

    Don't add to old threads, unless you have a solution. Post a new thread next time.

    Did you install the service packs for vb6? You'd have to do that.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  8. #8
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: Help: Run-time error '424' Object required

    I think JonnyPoet is on the right track.
    Only he forgot to use the myFrame variable:
    Quote Originally Posted by JonnyPoet
    The problem is here
    Code:
    Dim Action as Variant
    
    Dim myFrame as Frame
    .....
    	MsgBox TypeName(Action(3)) 'gets here
    ' Typeconvert the Variant now
    Set myFrame = Action(3)
    Then you'd call:
    Code:
    Call DisableFrame(myFrame, Enab) '******busts here
    I think you need to Set myFrame = It's an object.
    Last edited by WoF; November 9th, 2007 at 06:49 AM.

  9. #9
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: Help: Run-time error '424' Object required

    Quote Originally Posted by WoF
    I think JonnyPoet is on the right track.
    Only he forgot to use the myFrame variable:

    Then you'd call:
    Code:
    Call DisableFrame(myFrame, Enab) '******busts here
    I think you need to Set myFrame = It's an object.
    Yea sorrry you are totally right. That happens when posting even when to tired to think - too much stress at work in the moment - sorry I'll correct it in my post now. ( editing it )
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  10. #10
    Join Date
    Aug 2009
    Posts
    2

    Re: Help: Run-time error '424' Object required

    Hi. I'm having a similar problem; however i'm, a beginner and I don't understand most of these stuff but I try my best and i'm making progress. Kindly help me. I have this code (passed on by someone) and it gives two error messages.
    The first error message is the '424: Object-required' and the code is...


    Sub Initialize()

    ' Declare the local variables.
    Dim myvariable As Range

    'Set the random stuff.
    Rnd (-1)
    Randomize ([Rand_Seed])

    ' Reset the graph.
    [Frustration].Offset(1, 1) = 0
    [Frustration].Offset(2, 1) = 0 ... Program gives the 'object required' error message at this point.
    [GraphLabels].Clear
    [GraphValues].Clear



    Error 2. " ByRef argument; type mismatch "

    Code is:
    'The main group routine.
    Sub Activaterandomers()

    'Declare the local variables.
    Dim randomer As Range

    'Allow all of the randomers to execute.
    For Each randomer In [randomers]

    'Allow the next randomer to random
    Call random(randomers)

    Next randomer

    Ext randomer

    End Sub

    All help will be appreciated.

  11. #11
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: Help: Run-time error '424' Object required

    What language are you talking here?
    There is no Range data type in VB6, nor is a construct like [GraphLabels].clear part of VB's syntax.

  12. #12
    Join Date
    Aug 2009
    Posts
    2

    Re: Help: Run-time error '424' Object required

    It most definitely is VB6... trust me on this.

  13. #13
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Help: Run-time error '424' Object required

    Close. It might be VBA, though.
    Code:
    Public Sub LoopColumn()
    Dim c As Range
    
    For Each c In Range("A:A")
    
        If c.Value = "FindMe" Then
          MsgBox "FindMe found at " & c.Address
        End If
    
    Next c
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  14. #14
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: Help: Run-time error '424' Object required

    Oh yes, I forgot about VBA.. for Excel then, presumably.
    Well I have to pass on on this one. Not very familiar with Excel's VBA, I must admit.

  15. #15
    Join Date
    Nov 2009
    Posts
    1

    Re: Help: Run-time error '424' Object required

    Hi all,

    There is an autosaveback functionality implemented which on any changes to the word document should be saved ,while closing the document word document on to the server.

    I am using a word 2007 this works fine if i use the save option on the download of the file.

    Here is what is done :

    1. A web application which does a mail merging of the template fields shown as link field.
    2. On click of this link the merge word template is prompted by the broswer whether to Open,Save ,Cancelthe file .
    3. I then Open the file .
    4. The file opens but is not yet explicitily saved on the client and would be present in the TEMP directory !
    5. I do some changes to the Word document And click Close .
    6. The Macro code implemented ask for a confirmation whether do you want to save this to the Server ? I select Yes.
    7. On select of Yes i get an error which is "Runtime error 5487 - Word cannot complete the save to to file permission error ([path of the file name])".

    Please find the attached image which shows the error !
    I tried googling about the error but so far no luck !

    Regards,
    Francis P.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured