Is there a way to close an IE browser tab with VB? I've searched for hours and feel I'm missing something simple.
Here's the basic idea:
I'm importing data into Excel from web pages that also have links to pages that contain additional (detail) data. I open IE and navigate to a page, find the link, open a second tab... but after I access that second tab, I need to close it.
Here's some of the code I'm using -- everything works as expected until I need to close the second tab:
Any help is appreciated.Code:Sub MainProcess() ' Note that I have enabled references to the Microsoft HTML Object Library and Microsoft Internet Controls Dim IE As SHDocVw.InternetExplorer IE.Navigate URL ' some code to get the first batch of data I need and find the links to the additional data wbOpenNewTab detailLink ' where detailLink is defined above End Sub Private Sub wbOpenNewTab(URL) IE.Navigate2 URL, 1 ' This is where I copy the data I need IE.Quit ' This incorrectly closes the first tab, not the one I just opened End Sub


Reply With Quote
