you can trap the new window creation and provide your own IE object, then you can control the new window using the same code you already posted. Here's a simple example:
1. Declare 2 form level IE objects, be sure to declare them WithEvents (I'll assume they're called g_ie and g_ie2...)
2. Create the first IE object (g_ie) and call its Navigate function
using the code you posted already
3. because you declared g_ie WithEvents, you'll have a placeholder for a procedure named g_ie_NewWindow2. The default parameter ppDisp is the object that will be used to create the new window, so this is where g_ie2 comes in - add code here to supply your own IE object (g_ie2) instead of the default ppDisp. Like this:
Private Sub g_ie_NewWindow2(ppDisp As Object, Cancel As Boolean)
Set g_ie2 = New InternetExplorer
Set ppDisp = g_ie2
Cancel = False
End Sub
4. now the new window can be referenced using your variable g_ie2, so you can just fill in the form fields using g_ie2.Document and call g_ie2.Document.formname.submitname.submit to submit the form
hth
Phil
|