Results 1 to 4 of 4

Thread: VBA for IE (6)

  1. #1
    New Lounger
    Join Date
    Mar 2003
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VBA for IE (6)

    I'd like to try to control ie using vba, but can't seem to find an object library for it. i've tried all of the ones i can find in vba, but they don't seem to offer much. i want to be able to open the application and then send an address to it and then key strokes to get a website to respond.

    any ideas?

    thanks,

    tango

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VBA for IE (6)

    Set a reference in Tools | References to the Microsoft Internet Controls library.

    You can create an InternetExplorer object, and use its methods and properties:

    Dim ie As InternetExplorer.Application
    Set ie = CreateObject("InternetExplorer.Application")
    ie.Navigate "www.microsoft.com"

    See InternetExplorer Object (Internet Explorer - WebBrowser) for reference info.

    You'll find an example in <post#=499792>post 499792</post#>.

  3. #3
    New Lounger
    Join Date
    Mar 2003
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA for IE (6)

    thanks. I've got the website to come up. I'm trying to sendkeys to it to pass a userid and password to the site to login in, but it doesn't seem to take sendkeys. any idea?

    Sub test()

    Dim ie As Object
    Set ie = CreateObject("InternetExplorer.Application")
    ie.Navigate "www.msn.com"
    ie.Visible = True

    Do While ie.readystate <> 4 '= readystate_complete
    DoEvents
    Loop

    Application.SendKeys ("e")
    Application.SendKeys ("~")
    Application.SendKeys ("{tab}")
    End Sub

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VBA for IE (6)

    Instead of using SendKeys, find out the names of the fields in which the user can enter information, set their value and use the Submit method. The thread I posted a link to shows how it is done. You can use View | Code to study the HTML code for the web page and find the names of the fields, or load the page into one of the many web design tools.

Posting Permissions

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