Run-time error 424 macro

  • I have 2 forms created for an excel 2013 spreadsheet to use for input of data. One button works, but the other gives me a "Run-time error '424': Object required" message. I have the 2 buttons on a worksheet named "CAPAR Entry". The data is input to a worksheet named "CAPAR listing". I have used the same code for both buttons other than changing the form names. Here is the code:



    The error highlights "CAPARResponseForm.Show". My form name is "CAPARResponseForm", so I don't have a spelling error. I am a novice at vba and cannot determine why my macro doesn't work.

  • Re: Run-time error code 424 in button macro to open form


    Hi dolanmgc,


    Welcome to Ozgrid!!


    Firstly, change this line of code...


    Code
    Application.Calculation = xlCalculateManual


    ...to this:


    Code
    Application.Calculation = xlCalculationManual


    With regard to your error - that is usually due to the form name being different to what the code is using to open it. Ensure there are no spaces at the start or end of the form name and try again. If the problem persists use this code to determine the exact name of the form.


    Regards,


    Robert

  • Re: Run-time error code 424 in button macro to open form


    Thanks Robert,
    I did verify the form name prior to posting, so I know that was not the cause. I tried to use your code to verify the form name, though, but I get a Run-time error '1004': Programmatic access to Visual Basic is not trusted. I did the reference update as instructed. In any case, I'll make the change to the code as you instructed, since I was wondering about that anyway. I had copied and pasted the code and updated references within the code. In any case, I had started over yesterday and was able to get both buttons to work. I was going to delete this thread but was unable to do so. I appreciate your time and have learned at least a little bit more. Every little bit helps.

  • Re: Run-time error 424 macro


    When you get the error, keep pressing f8 to step into the code in the userform. It is likely the real error is in there.

    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

  • Re: Run-time error 424 macro


    Thanks Rory,


    Once I get past the 1st error, I get another Run-time error '104': Method 'VBProject' of object'_Workbook' failed. Since I have everything I need working, this is not something I really need to fix. The error highlights the line of code:
    [code]
    For Each vbc In ThisWorkbook.VBProject.VBComponents
    [code]


    If you can tell why this may not be working, great. I'm fine to let this go and not waste anyone's time. I appreciate the time y'all put into this forum.

  • Re: Run-time error 424 macro


    I'd assume you haven't got trusted access to the VBA project set in your Trust Center security settings.

    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

  • Re: Run-time error 424 macro


    You are correct Rory. All the Macro Settings are grayed out, so I can't change it. That's one of the frustrations working in a .mil environment.


    Thanks!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!