PDA

View Full Version : [SOLVED] Object Required For Parameter



Vladiedoo
06-30-2013, 12:42 PM
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.

p45cal
06-30-2013, 02:30 PM
replace:

IEQuit (IE)
with:

IEQuit IE

afzalw
06-30-2013, 02:34 PM
Try removing the brackets around the object name

Loop
IEQuit IE
End Sub

Vladiedoo
06-30-2013, 03:08 PM
Thank you p45cal and afzalw, the solution works :)