Copy and Close Tabs Using VBA

Barklie

Board Regular
Joined
Jul 4, 2013
Messages
76
Hi, I am trying to use excel to extract data and have reached a roadblock when it comes to extracting website contents. The three things I would like to be able to do are:

1) Bring up an open internet browser (preferably Firefox but IE will do)
2) Select and copy entire webpage contents
3) Close the current tab

I have figured out a way to bring up IE (albeit roundabout), but cannot accomplish the other two objectives. Any help would be greatly appreciated. Here is my code thus far...

Public Sub Find_IE_Windows()

Dim Shell As Object
Dim IE As Object


Set Shell = CreateObject("Shell.Application")

For Each IE In Shell.Windows
If TypeName(IE.document) = "HTMLDocument" Then
IE.Navigate IE.LocationURL
End If
Next

End Sub
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,143,658
Messages
5,720,128
Members
422,267
Latest member
olund

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top