Sub pasteMyWebP()
Dim wb As Workbook, ws As Worksheet
Dim IE As Object
Const strURL As String = "http://www.MrExcel.Com"
Set wb = Workbooks.Add(xlWBATWorksheet)
Set ws = wb.Sheets(1)
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate strURL
Do While IE.ReadyState <> 4
DoEvents
Loop
IE.ExecWB 17, 2
IE.ExecWB 12, 2
ActiveSheet.Paste Range("A1")
IE.Visible = False
End Sub
'Note: I got "IE.ExecWB 17, 2" & "IE.ExecWB 12, 2" from Juan Pablo Gonzales and do not know what it is?
'But, it is what copies the web page!
"ExceWB" is the OLE Object handler of:
The IOleCommandTarget interface, which enables objects and their containers to dispatch commands to each other. For example, an object's toolbars may contain buttons for commands such as Print, Print Preview, Save, New, and Zoom.
Because no efficient, standard mechanism has been available to dispatch them to the container. No efficient means to send commands such as Print, Page Setup, and Properties to an in-place active object. Such simple command routing could have been handled through existing OLE Automation standards and the IDispatch interface, but the overhead with IDispatch is more than is required in the case of document objects. The IOleCommandTarget interface provides a simpler means to achieve the same ends.
The interface allows a caller both to query for support of one or more commands within a group and to issue a supported command to the object.