Hi Raymond,

Hope it might helps you,

Put below code in a module and add refrence of "Microsoft Internet Controls"

Option Explicit

Declare Function apiShowWindow Lib "user32" Alias "ShowWindow" _
            (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

Sub Test()

    Call CopyWebPage

End Sub

Private Sub CopyWebPage(Optional IEVisible As Boolean = False)
    
    Dim IE                                      As InternetExplorer
    Dim wksSheet                                As Worksheet
    Dim dtTime                                  As Date
    
    Application.DisplayAlerts = False
    Application.EnableEvents = False
    
    If Application.ScreenUpdating Then Application.ScreenUpdating = False
    
    Set wksSheet = ThisWorkbook.Worksheets("sheet1")
    wksSheet.DrawingObjects.Delete
    wksSheet.Cells.Clear
    
    Set IE = New InternetExplorer
    With IE
        apiShowWindow .hwnd, 3
        .Visible = IEVisible
        .Navigate 
"http://www.nseindia.com/live_market/dynaContent/live_watch/equities_stock_watch.htm?cat=N";
        'Wait for initial page to load
        Do While .readyState <> READYSTATE_COMPLETE Or .Busy: DoEvents: Loop
    
        'Copying website
        dtTime = Now()
Begin:
        If Now() <= DateAdd("s", 3, dtTime) Then
            GoTo Begin
        End If
        .ExecWB OLECMDID_SELECTALL, OLECMDEXECOPT_DODEFAULT
        .ExecWB OLECMDID_COPY, OLECMDEXECOPT_DODEFAULT
        .ExecWB OLECMDID_CLEARSELECTION, OLECMDEXECOPT_DODEFAULT
        .Quit
    End With
    With wksSheet
        Application.Goto .Range("A1")
        .Paste
        Application.CutCopyMode = False
        .Cells(301, 1).Resize(100).EntireRow.Delete
        .Cells(1, 1).Resize(247).EntireRow.Delete
        DeleteShapes ("$1:$2")
        DeleteShapes ("$54:$54"), False
        .Range("A1").CurrentRegion.Font.Size = 8
        Application.Goto .Range("A1")
    End With
    Set IE = Nothing
    
End Sub

Private Sub DeleteShapes(ByVal strRange As String, Optional blnDelOtherShp 
As Boolean = True)

    Dim Sh As Shape
    With Worksheets("Sheet1")
        For Each Sh In .Shapes
            If Not Application.Intersect(Sh.TopLeftCell, .Range(strRange)) 
Is Nothing Then
                Sh.Delete
            End If
        Next Sh
        For Each Sh In .Shapes
            If Not Sh.Name Like "Picture*" Then
                Sh.Delete
            End If
        Next Sh
    End With

End Sub

and call "Test" procedure whereever you need to refresh may be in button 
click or some where else.



Regards,
Lalit Mohan

On Tuesday, 18 December 2012 19:24:04 UTC+5:30, raymond...@gmail.com wrote:
>
> Wrote an HTML request for a client to pull prices from a competitors 
> website sent to Him and while it works on his ‘office’ machines it does not 
> work on his laptop.  The get requests returns different html than my laptop 
> does.  If I have him copy the URL into his browser web page comes back 
> perfectly… 
>
>  
>
> I am thinking some kind of versioning? 
>  He is using excel 2010 and I am using 2007
> But should that affect the HTTP request (Purely VBA)???
>  
> Any help would be greatly appreciated...
>

-- 
Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To post to this group, send email to excel-macros@googlegroups.com.
To unsubscribe from this group, send email to 
excel-macros+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros?hl=en.


Reply via email to