+ Reply to Thread
Results 1 to 5 of 5

Why no hints after typing .

  1. #1
    Mike NG
    Guest

    Why no hints after typing .

    I have a webbrowser object embedded within Sheet1 (called WB)

    In my code if I type WB.
    I get offered a list of valid sub-parameters (Document being one of
    them)
    If I choose Document then type . again, I don't see the list of valid
    sub-parameters for the next level down

    I am particularly interested in the sub-parameters of Document.Links and
    Document.Images

    I can compile my code and guess the parameter below links, e.g.
    ..Document.Links(0).src - but I don't know until run time whether the
    'src' parameter is valid or not

    I have tried looking at this page
    <http://msdn.microsoft.com/workshop/a...collections/li
    nks.asp>
    This makes a reference to the href property, but nowhere can I find a
    complete listing of the properties

    Any help appreciated
    --
    Mike
    Please post replies to newsgroup to benefit others
    Replace dead spam with ntl world to reply by email

  2. #2
    Forum Contributor
    Join Date
    12-11-2004
    MS-Off Ver
    2007
    Posts
    137
    hello Mike

    this macro ( in a USF/WebBrowser) list all the links of a Web page


    Private Sub CommandButton3_Click()
    'List all the images sources of a Web page
    '*************************************************************
    'activate référence Microsoft HTML Objects Library
    'activate référence Microsoft Internet Controls
    Dim maPageHtml As HTMLDocument
    Dim imgHtml As HTMLImg
    Dim i As Integer, X As Integer
    Dim laListe As String

    WebBrowser1.navigate "http://www.excel-downloads.com"
    Do
    DoEvents
    Loop While WebBrowser1.Busy 'wait end page loading

    Set maPageHtml = WebBrowser1.document

    For i = 0 To WebBrowser1.document.links.Length - 1
    Cells(i + 1, 1) = maPageHtml.links.Item(i)
    Next

    End Sub



    another exemple to list all the images source of a Web page

    Private Sub CommandButton3_Click()
    'List all images source of Web page
    '*************************************************************
    'test with WinXP & Excel2002
    'activate référence Microsoft HTML Objects Library
    'activave référence Microsoft Internet Controls
    Dim maPageHtml As HTMLDocument
    Dim imgHtml As HTMLImg
    Dim i As Integer, X As Integer
    Dim laListe As String

    WebBrowser1.navigate "http://www.excel-downloads.com"
    Do
    DoEvents
    Loop While WebBrowser1.Busy

    Set maPageHtml = WebBrowser1.document
    MsgBox "number of pictures in the page : " & maPageHtml.images.Length

    For i = 0 To maPageHtml.images.Length - 1 'boucle sur les images
    Set imgHtml = maPageHtml.images.Item(i)

    If InStr(laListe, imgHtml.src) = 0 Then 'controle des doublons dans la page
    laListe = laListe & imgHtml.src & vbLf
    X = X + 1
    Feuil2.Cells(X, 1) = imgHtml.src 'adresse image
    Feuil2.Cells(X, 2) = imgHtml.Width 'largeur image
    Feuil2.Cells(X, 3) = imgHtml.height 'hauteur image

    End If
    Next i

    End Sub



    in the link below you will find more interesting informations about it

    http://compm067.paisley.ac.uk/notes/unit06.html


    I hope this help you
    regards
    michel

  3. #3
    Forum Contributor
    Join Date
    12-11-2004
    MS-Off Ver
    2007
    Posts
    137
    Re Hello Mike

    oouppss…sorry... ,i sent my message to quickly

    you don't need some variables in the first macro


    Private Sub CommandButton3_Click()
    'List all the images sources of a Web page
    '************************************************* ************
    'activate référence Microsoft HTML Objects Library
    'activate référence Microsoft Internet Controls
    Dim maPageHtml As HTMLDocument
    Dim i As Integer

    WebBrowser1.navigate "http://www.excel-downloads.com"
    Do
    DoEvents
    Loop While WebBrowser1.Busy 'wait end page loading

    Set maPageHtml = WebBrowser1.document

    For i = 0 To WebBrowser1.document.links.Length - 1 'number ok links in the page
    Cells(i + 1, 1) = maPageHtml.links.Item(i)
    Next

    End Sub



    regards
    michel

  4. #4
    Rob van Gelder
    Guest

    Re: Why no hints after typing .

    I added a control and looked at the definition of Document from the Object
    Browser.
    Document is defined as a plain object. The IDE doesn't know the
    methods/parameters because it could be any sort of automation object.

    --
    Rob van Gelder - http://www.vangelder.co.nz/excel


    "Mike NG" <[email protected]> wrote in message
    news:[email protected]...
    >I have a webbrowser object embedded within Sheet1 (called WB)
    >
    > In my code if I type WB.
    > I get offered a list of valid sub-parameters (Document being one of them)
    > If I choose Document then type . again, I don't see the list of valid
    > sub-parameters for the next level down
    >
    > I am particularly interested in the sub-parameters of Document.Links and
    > Document.Images
    >
    > I can compile my code and guess the parameter below links, e.g.
    > .Document.Links(0).src - but I don't know until run time whether the 'src'
    > parameter is valid or not
    >
    > I have tried looking at this page
    > <http://msdn.microsoft.com/workshop/a...collections/li
    > nks.asp>
    > This makes a reference to the href property, but nowhere can I find a
    > complete listing of the properties
    >
    > Any help appreciated
    > --
    > Mike
    > Please post replies to newsgroup to benefit others
    > Replace dead spam with ntl world to reply by email




  5. #5
    Mike NG
    Guest

    Re: Why no hints after typing .

    On Mon, 24 Jan 2005 at 08:09:42, Rob van Gelder (Rob van Gelder
    <[email protected]>) wrote:
    >I added a control and looked at the definition of Document from the Object
    >Browser.
    >Document is defined as a plain object. The IDE doesn't know the
    >methods/parameters because it could be any sort of automation object.
    >

    Ah right. Many thanks
    --
    Mike
    Please post replies to newsgroup to benefit others
    Replace dead spam with ntl world to reply by email

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1