I want to be able to capture the IE event NewWindow2, so that I can grab the IE instance in the pop-up. I've tried to do this by defining my IE instance this way:
</font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">
Private WithEvents CurrentIE As InternetExplorer.
</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">But it says 'only valid in object module'. I've also tried adding this declaration to a class module but when I try to reference the class module in a shared module it says 'Automation Error Unspecified Error'.

Does anyone have any clue how I could accomplish this?