How to get active tab in IE using VBA

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

I am working on one spreadsheet where hundreds of websites are listed and few details. I have written one macro where it opens an IE and read excel rows and open multiple websites in different tabs. I would like to flag one message box stating that no of tabs opened and last tab would be my active tab? Can you please help me out to active last tab in IE and count no of tabs successfully opened ?

Any help would be most appreciated.

edited answer

Not sure how your code works but I would create a separate IE application (Set IE=CreateObject(“InternetExplorer.application”)) e.g. in an VBA Object Array for each website. Then you should be able to simply count the amount of active IE Applications (or if you are closing them then mark = Nothing and then check if is Nothing).

Debug.Print IE.Document.URL

Should get the name of the URL

Try one of the below to focus the window:
IE.visible = True

Should focus the window.

edited answer

Simply the best place to learn Excel VBA