Results 1 to 5 of 5

Thread: How do you close IE from VB ?

  1. #1

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    Question How do you close IE from VB ?

    This could end up being the most stupid question I have ever posted, but here goes .............

    If the following line of code opens IE (which it does), how do I then close IE ?

    I tried the obvious of duplicating the line and changing "Open" to "Close", but nope.

    VB Code:
    1. OpenPage = ShellExecute(Form1.hwnd, "Open", "C:\test.html", 0&, 0&, 0&)


    So, am I being dull ?

  2. #2
    Fanatic Member
    Join Date
    Jul 2001
    Location
    London UK
    Posts
    671
    I don't think that you are being dull (or if so then that makes 2 of us!)

    I think you will need to use the TerminateProcess API but I don't have any sample code handy for this

  3. #3
    Fanatic Member
    Join Date
    Jul 2001
    Location
    London UK
    Posts
    671
    Hack's post here looks promising!

    http://www.vbforums.com/showthread.p...hreadid=142966

  4. #4

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818
    Cheers Martin.

    I found some code eventually, and its simpler, thus :

    VB Code:
    1. Set ie = CreateObject("InternetExplorer.Application")
    2.     ie.Navigate ("www.btopenworld.com")
    3.     ie.Visible = True
    4.     ie.Top = 0
    5.     ie.Left = 0
    6.     ie.Height = 600
    7.     ie.Width = 800
    8.    
    9.     ie.quit
    10.     Set ie = Nothing

    Thanks for your help

  5. #5
    Fanatic Member
    Join Date
    Jul 2001
    Location
    London UK
    Posts
    671
    Aah, Nice solution!

Posting Permissions

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



Click Here to Expand Forum to Full Width