Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8342079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:40:04+00:00 2026-06-09T05:40:04+00:00

The code below works the first time it is run but often fails on

  • 0

The code below works the first time it is run but often fails on subsequent runs.
The line where it fails is commented below. I think that looping through SHDocVw.ShellWindows creates the issue and I need to clean up something before running it again. To duplicate the issue, Open google in IE and then run this procedure, repeat. Thanks for any help. The exact error is Exception from HRESULT: 0x800A01B6 . (Note that this is a simplified version of more complex code where I actually do reuse IE_test many times if it’s set.)

    Public IE_test As SHDocVw.InternetExplorer
    Sub TestIE()
    Dim shellWindows_3 As New SHDocVw.ShellWindows()
    Dim htmlDoc As String
    Dim link1 = "google.com"
    If IsNothing(IE_test) = True Then
        For Each ie_x As SHDocVw.InternetExplorer In shellWindows_3
            If ie_x.LocationURL.Contains(link1) Then 'find the google instance
                IE_test = ie_x
            End If
        Next
    End If

    With IE_test
        .Visible = True
        htmlDoc = .Document.Body.InnerHtml 'Fails here on second run
        .Quit()
    End With

    IE_test = Nothing
    MsgBox(Len(htmlDoc))

End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T05:40:07+00:00Added an answer on June 9, 2026 at 5:40 am

    I ended up solving this issue by completely removing .Quit() from any procedure (until the program closes). Now, I am always reusing the existing instances of IE rather than closing and reopening which is what allows the error to be avoided.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

the code below works fine but it takes an absolute age to run. How
The code below works well but grabs only the UIView which is VISIBLE on
The code below works fine. But it seem clunky. How would you combine the
The code below works great. I have a MySQL database that contains book titles
My below code worked fine while running in .NET 4.0 but when I run
The code below works well right now; however, it's serially executed. I'd like to
the code below works in Windows Phone 7 private void ShowTime() { txtTime.Text =
The code below works nicely. Each title in the MySQL table submission is printed
The code below works unless p.School.SchoolName turns out to be null, in which case
The code below works great except the email has all the text on one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.