Results 1 to 7 of 7

Thread: Capture values from IE page

  1. #1
    Junior Member
    Join Date
    Jun 2011
    Posts
    7
    Rep Power
    0

    Question Capture values from IE page

    Hi guys,
    I am looking to capture price, Shipping values to from below mentioned site
    DELL D620 CORE 2 DUO 1.66GHZ LAPTOP 40GB WIFI 1GB OFFICE WIN XP CHEAP | eBay
    values has to be captured offset of active cell like 0,5 and 0,6

  2. #2
    Member littleiitin's Avatar
    Join Date
    Aug 2011
    Posts
    90
    Rep Power
    14

    Fetching Data from Web

    Hi Maruthi,

    Welcome to the board,

    Please find attached file for your solution.



    Thanks
    Rahul Singh
    Attached Files Attached Files

  3. #3
    Junior Member
    Join Date
    Jun 2011
    Posts
    7
    Rep Power
    0

    Thanq very much Rahul Singh

  4. #4
    Junior Member
    Join Date
    Jun 2011
    Posts
    7
    Rep Power
    0
    Hi rahul,

    a small alteration we cannot give url every time. we have to fetch data such a way that
    it has to got active window of internet explorer and then it has to fetch values from there.
    clearly means we will be in excel when we run the macro(VBA) it has to navigate to already opened website and copy values from there. i have code for window navigate please check it out
    On Error Resume Next
    AppActivate "Windows Internet Explorer"
    will be waiting for your early reply.
    Thanks in advance
    Regards,
    Maruthi

  5. #5
    Junior Member
    Join Date
    Jun 2011
    Posts
    7
    Rep Power
    0
    Can you help me out please

  6. #6
    Member littleiitin's Avatar
    Join Date
    Aug 2011
    Posts
    90
    Rep Power
    14
    Maruthi,

    Please always mention all links for cross posts, so that if solution is already provided others would not try.
    Please mention all the cross post links first.

  7. #7
    Member littleiitin's Avatar
    Join Date
    Aug 2011
    Posts
    90
    Rep Power
    14
    Hi Maruti,

    Please Replace original code with below one I believe this will solve your problem:

    Code:
    Public Sub InkWeb()
        
        Dim MyPost                  As String
        Dim MyUrl                   As String
        Dim PostUser                As String
        Dim PostPassword            As String
        Dim wbkTemp                 As Workbook
        Dim strPrice                As String
        Dim strShipChar             As String
        Dim IEwindow                As SHDocVw.InternetExplorer
        Dim allExplorerWindows      As New SHDocVw.ShellWindows
        Dim rngPaste                As Range
        Dim rngPrice                As Range
        Dim rngShipping             As Range
        Dim rngBML                  As Range
        Application.ScreenUpdating = False
        Set allExplorerWindows = New SHDocVw.ShellWindows
        For Each IEwindow In allExplorerWindows
            
            MyUrl = IEwindow.LocationURL
            If InStr(1, MyUrl, "ebay") > 0 Then
                Set wbkTemp = Workbooks.Add(1)
                With wbkTemp.Worksheets("sheet1").QueryTables.Add(Connection:="URL;" & MyUrl, Destination:=Cells(5, 1))
                    .PostText = MyPost
                    .BackgroundQuery = True
                    .TablesOnlyFromHTML = True
                    .Refresh BackgroundQuery:=False
                    .SaveData = True
                End With
                With wbkTemp.Worksheets("Sheet1")
                    Set rngPrice = .Cells.Find("Price:", , , xlWhole)
                    strPrice = rngPrice.Offset(, 1)
                    On Error Resume Next
                        Set rngShipping = .Cells.Find("Shipping:", , , xlWhole)
                        
                        'Set rngBML = .Cells.Find("Bill Me Later", , , xlPart)
                        strShipChar = rngShipping.Offset(, 1)
    
                    On Error GoTo 0
                End With
                wbkTemp.Close 0
                Set wbkTemp = Nothing
                With ThisWorkbook.Worksheets("FetchData")
                    If .Range("rngPrice").Value <> "" Then
                        If .Range("rngPrice").End(xlDown).Row <> .Rows.Count Then
                            Set rngPaste = .Range("rngPrice").End(xlDown).Offset(1)
                        Else
                            Set rngPaste = .Range("rngPrice").Offset(1)
                        End If
                        rngPaste.Value = strPrice
                        rngPaste.Offset(, 1).Value = strShipChar
                    Else
                        MsgBox "Please set the Header ""Price"" in Cell B6", vbInformation
                        Exit Sub
                    End If
                End With
            End If
            
        Next
    
        Application.ScreenUpdating = True
    End Sub
    Last edited by littleiitin; 11-22-2011 at 10:19 AM.

Similar Threads

  1. Feed / Post Data on Web Page Using VBA
    By in.vaibhav in forum Excel Help
    Replies: 10
    Last Post: 01-10-2013, 05:00 PM
  2. Replies: 2
    Last Post: 09-08-2012, 10:50 PM
  3. Replies: 0
    Last Post: 03-06-2012, 03:55 AM
  4. Executing XLSM file on a web page
    By Rasm in forum Excel Help
    Replies: 1
    Last Post: 12-17-2011, 05:38 AM

Posting Permissions

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