VBA open an instance of IE and browse to a specific URL

Author Message
deshodes

  • Total Posts : 3
  • Scores: 0
  • Reward points : 0
  • Joined: 8/16/2010
  • Status: offline
VBA open an instance of IE and browse to a specific URL Monday, August 16, 2010 11:20 PM (permalink)
0
I am trying to have VBA open an instance of IE and browse to a specific
URL

Private Sub DrawingIn_Click()
Set browser = CreateObject("InternetExplorer.Application")
browser.Navigate ("www.mywebpage.com")
browser.StatusBar = False
browser.Toolbar = False
browser.Visible = True
browser.Resizable = False
browser.AddressBar = False
End Sub

I got that portion to work

Now I need to search for a hypertext link named "spread***" within
the page i've navigated to. And after that click on them.


Can someone please help me complete the code to

1) Find the Spread*** hyperlink
2) Click it
 
#1
    rasimmer

    • Total Posts : 2363
    • Scores: 163
    • Reward points : 0
    • Joined: 3/19/2009
    • Location: Cedar Rapids, IA
    • Status: offline
    Re:VBA open an instance of IE and browse to a specific URL Tuesday, August 17, 2010 2:35 AM (permalink)
    0
    You need to use HTML DOM to parse the page and send the click event.  Search the forum for examples.
     
    #2
      deshodes

      • Total Posts : 3
      • Scores: 0
      • Reward points : 0
      • Joined: 8/16/2010
      • Status: offline
      Re:VBA open an instance of IE and browse to a specific URL Tuesday, August 17, 2010 3:18 AM (permalink)
      0
      Thx for replay, I search the forum and foud this examples, but did not work form me.
       
      Set IE = WScript.CreateObject("InternetExplorer.Application", "Browser_")
       IE.Visible = True
       IE.AddressBar = True
       IE.MenuBar = True
       IE.Navigate "http://www.ticketmaster.com/"
       Do Until IE.ReadyState = 9293
       WScript.Sleep 500
       Loop
       IE.document.getElementsByTagName("form")(128129).getElementsByTagName("input")(138139).value = "la boheme"
       IE.document.getElementsByTagName("form")(162163).submit()
       Do Until IE.ReadyState = 184185
       WScript.Sleep 500
       Loop
       WScript.Sleep 2000
       '------------------------------------
       'http://www.ticketmaster.com/artist/
       '------------------------------------
       Dim colLinks : Set colLinks = IE.Document.getElementsByTagName("a")
       '
      loop through links
       Dim objLink
       For Each objLink In colLinks
           ' check text for link
           If InStr(UCase(objLink.innerHTML), "LA BOHEME") > 0 Then
                '
      navigate to the first match and exit the for...next loop
                objLink.Click()
           End If
       Next
       WScript.Sleep 5000
       
      Thanks in advance!
       
      #3

        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • New Messages
        • No New Messages
        • Hot Topic w/ New Messages
        • Hot Topic w/o New Messages
        • Locked w/ New Messages
        • Locked w/o New Messages
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2012 ASPPlayground.NET Forum Version 3.9