title: VBA, get and manage the active web page after browser closing and re-opening
body: <p>in my Access &amp; VBA application i Have to get and manage a web page of a web order application. Normally, I use the solution indicated in this post, which normally works perfectly:</p>
  
  <p><a href="https://stackoverflow.com/questions/43569876/vba-open-web-page-login-and-get-the-opened-page/43570071#43570071">VBA Open web page, login and get the opened page</a></p>
  
  <p>But, now I have another old web application to connect with my Access software. In this web application, after login, the web page closes itself and open an other browser session with the first user page. In other words:</p>
  
  <p>1) The user fill the login form with the user credentials
  2) After login, the login web page closes the browser
  3) An other browser session opens with the web app control panel</p>
  
  <p>If I use the linked solution, I see an error. How can I get the new web page, in the new browser session, which opens it self after login?</p>
  
  <p>Thanks! </p>
  
  <p>EDIT</p>
  
  <p>I have tried the following code (my purpose is set a text value in the web page). But, very strange, it works only if I put a text box in my code: maybe the code must wait some event! How can I solve it?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>Dim SWs As SHDocVw.ShellWindows, vIE As SHDocVw.InternetExplorer
  Dim winShell As Shell
  Dim dt As Date
  dt = DateAdd("s", 10, DateTime.Now)
  Dim ieA As InternetExplorer
  Dim IeDocA As HTMLDocument
  Do While dt &gt; DateTime.Now
  
     Set winShell = New Shell
  
     For Each ieA In winShell.Windows
         If ieA.LocationURL = sURL Then
  
         ieA.Visible = True
         ieA.Silent = True
  
         Do While ieA.Busy: DoEvents: Loop
         Do Until ieA.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
         Set IeDocA = ieA.Document
         
         //only with this msgbox it works, how can I do this w/out it?       
         MsgBox IeDocA.title
  
         With IeDocA
               .getElementsByName("text").value="something"
         End With
  
         Set winShell = Nothing
         Exit Do
  
         End If
  
     Next ieA
     Set winShell = Nothing
     DoEvents
  
  Loop</code></pre>
  </div>
  </div>
  </p>