Consulting

Results 1 to 3 of 3

Thread: Solved: how do I close other app with vba

  1. #1
    VBAX Regular
    Joined
    Jun 2007
    Posts
    8
    Location

    Solved: how do I close other app with vba

    Hi,
    I am working with vba in excel 2003 and have the following problem. I need to open internet explorer and then latter I need to close it. I can open it with:

    [VBA]Public Sub OpenInetExplorer()
    ActiveWorkbook.FollowHyperlink "http://www.google.com"
    End Sub
    [/VBA]
    But I have not been able to find a way to close it useing vba.
    Can anyone help, please?
    Thanks,
    dmat619

  2. #2
    VBAX Mentor MaximS's Avatar
    Joined
    Sep 2008
    Location
    Stoke-On-Trent
    Posts
    360
    Location
    try this:

    [VBA]
    Sub Demo()

    Dim ie As Object

    Set ie = CreateObject("InternetExplorer.Application")

    ie.navigate "http://www.google.com/"

    Do While ie.busy And Not ie.readystate = 4

    DoEvents

    Loop

    ie.Visible = True

    Application.Wait Now + TimeSerial(0, 0, 5)

    ie.Quit

    Set ie = Nothing

    End Sub
    [/VBA]


    this should close IE windows

    [VBA]ie.Quit[/VBA]

  3. #3
    VBAX Regular
    Joined
    Jun 2007
    Posts
    8
    Location

    Thanks

    Thanks MaximS,

    That worked perfect. I was afraid I would have to use API calls. Your solution was both simple and easily understandable.

    Thanks again,
    dmat619

Posting Permissions

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