Consulting

Results 1 to 4 of 4

Thread: Object Required For Parameter

  1. #1

    Object Required For Parameter

    Hi, I'm new to VBA and have experience in Java.

    I was wondering why the following code gave me "Run-time error '424': Object required" when I try to call the IEQuit function.


    Function GetIE() As Object
    Set GetIE = CreateObject("InternetExplorer.Application")
    End Function
     
    Sub Test()
    Dim IE As Object
    Set IE = GetIE
    With IE
        .navigate "link" 'Link to any website goes here.
        .Visible = True
    End With
    Do While IE.Busy
        Application.Wait DateAdd("s", 1, Now)
    Loop
    IEQuit (IE)
    End Sub
     
    Function IEQuit(ByRef inet As Object)
    inet.Quit
    End Function
    Thank you in advance for your help and time.
    Last edited by Aussiebear; 04-25-2023 at 07:26 PM. Reason: Adjusted the code tags

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    replace:
    IEQuit (IE)
    with:
    IEQuit IE
    Last edited by Aussiebear; 04-25-2023 at 07:27 PM. Reason: Added code tags
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    VBAX Regular
    Joined
    Jun 2012
    Posts
    45
    Location
    Try removing the brackets around the object name
    Loop
        IEQuit IE
    End Sub
    Last edited by Aussiebear; 04-25-2023 at 07:27 PM. Reason: Adjusted the code tags

  4. #4
    Thank you p45cal and afzalw, the solution works

Posting Permissions

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