Consulting

Results 1 to 2 of 2

Thread: Get Data from IE Error ....

  1. #1
    VBAX Contributor
    Joined
    Jun 2008
    Posts
    169
    Location

    Get Data from IE Error ....

    Hi, All
    Since i change windows 7 then the code was can't work !! does it the mail issue computer version or the IE 9 problem ?

    [VBA] Dim lnk As Object, ie As Object, doc As Object, i As Long, lr As Long, r As Long, X As Long
    Dim Start As Single
    Dim TimeRange As Variant
    Dim Sr, Irow As Long
    Const Pause = 900
    If Cells(1, 1) = "STA Run Start" Then
    Else
    Exit Sub
    End If
    Do While True
    Sheets("Web Data").Visible = True
    Sheets("Web Data").Select
    Cells.Select
    Selection.ClearContents
    IndexI = 2
    For i = 1 To 3
    URLLINK = Sheet1.Cells(i, 1)
    Set ie = CreateObject("InternetExplorer.Application")
    With ie
    URL = URLLINK
    .Visible = False
    .Navigate URLLINK
    Do Until .ReadyState = 4: DoEvents: Loop
    Set doc = ie.document
    .ExecWB 17, 0
    .ExecWB 12, 2
    .Quit
    End With
    Set ie = Nothing
    [/VBA]

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    I don't know what doesn't work. When working a problem, it is best to have a short snippet of complete code to test.

    There are MSIE object methods and other methods that can get parts of a web page. It just depends on your needs.

    From a blank sheet, try this:
    [VBA]Sub TestIE_Import()
    Dim IE As Object
    Set IE = CreateObject("InternetExplorer.Application")
    With IE
    .Visible = True
    .Navigate "http://msn.com"
    Do Until .ReadyState = 4: DoEvents: Loop
    .ExecWB 17, 0 '// SelectAll
    .ExecWB 12, 2 '// Copy selection
    ActiveSheet.PasteSpecial Format:="Text", link:=False, DisplayAsIcon:=False
    'Range("A1").PasteSpecial
    .Quit
    End With
    End Sub[/VBA]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •