Set ie = CreateObject(“InternetExplorer.Application”) is not workiing with protected mode ON with Tr


I have one project created with VB 6.0. Below is the code.

Step to reproduced this issue,

1. Start Internet explorer and add the site “” to trusted site. now set protected mode check box to Off for the trusted site zone.

2. Open the Visual Basic 6.0 and created standard Exe project.

3. From Tools -> references add “Microsoft Internet Controls”.

4. Copy and Paste below code.

'General DeclarationDimWithEvents ie As SHDocVw.InternetExplorer

PrivateSub Form_Load()

Set ie = CreateObject("InternetExplorer.Application")
ie.Navigate2 ""
ie.Visible = TrueEndSubPrivateSub ie_DocumentComplete(ByVal pDisp AsObject, URL AsVariant)

MsgBox "Document complete"EndSubPrivateSub ie_OnQuit()

MsgBox "IE quit."EndSub

Now the problem what I am facing is that when I ran this code It opens the IE and navigate to the given URL but suddenly it called the onQuit event though the IE is still open. If I set the Protected mode ON for the Trusted site zone it is working fine and
IE_Document complete called perfectly.

I am using Windows 7 Professional and Internet Explorer 8.

May I know what is the issue? What should I do to make it run for both setting i.e. Protected Mode On or OFF.

hello,This is not a VB6 forum, but this is in VB10 the same with exception for the initialization of the object  which can bePrivate WithEvents ie As new SHDocVw.InternetExplorerBe aware that if you use shdocvw.DLL (AxWebbrowser) the document  complete means a frame.You have to be sure everything is completed,See here for more information. more help about VB6 have a look in this link.