Hi
I have a code that open a webpage then copy it and paste on a1
I want to know if there is a way to add a loop that take 10 webpages and paste tham on columns a1-i1
my code:
Sub test()
On Error Resume Next
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate "CNN International - Breaking News, US News, World News and Video"
Do
If IE.ReadyState = 4 Then
IE.Visible = False
Exit Do
Else
DoEvents
End If
Loop
'Wait for window to open!
Application.Wait (Now + TimeValue("0:00:01"))
IE.Visible = True
IE.ExecWB 17, 0 '// SelectAll
Application.Wait (Now + TimeValue("0:00:01"))
IE.ExecWB 12, 2 '// Copy selection
Application.Wait (Now + TimeValue("0:00:01"))
IE.Quit
' End With
Set IE = Nothing
Application.Wait (Now + TimeValue("0:00:01"))
Range("A1").Select
ActiveSheet.PasteSpecial Format:="Unicode Text", link:=False, _
DisplayAsIcon:=False
Application.CutCopyMode = False
End Sub
I have a code that open a webpage then copy it and paste on a1
I want to know if there is a way to add a loop that take 10 webpages and paste tham on columns a1-i1
my code:
Sub test()
On Error Resume Next
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate "CNN International - Breaking News, US News, World News and Video"
Do
If IE.ReadyState = 4 Then
IE.Visible = False
Exit Do
Else
DoEvents
End If
Loop
'Wait for window to open!
Application.Wait (Now + TimeValue("0:00:01"))
IE.Visible = True
IE.ExecWB 17, 0 '// SelectAll
Application.Wait (Now + TimeValue("0:00:01"))
IE.ExecWB 12, 2 '// Copy selection
Application.Wait (Now + TimeValue("0:00:01"))
IE.Quit
' End With
Set IE = Nothing
Application.Wait (Now + TimeValue("0:00:01"))
Range("A1").Select
ActiveSheet.PasteSpecial Format:="Unicode Text", link:=False, _
DisplayAsIcon:=False
Application.CutCopyMode = False
End Sub