Results 1 to 3 of 3

Thread: IE is running but can't detect

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    KL, Malaysia
    Posts
    7

    Question IE is running but can't detect

    Dear all,
    I tried the following code to detect InternetExplorer. I have my IE running and run the code. But my prog return "can't detect IE"

    Sub DetectIE()
    Dim MyIE As Object

    On Error GoTo NoIE
    Set MyIE = GetObject(, "InternetExplorer.Application")
    MsgBox "IE is running"
    Exit Sub

    NoIE:
    MsgBox "can't detect IE"

    End Sub


    Please help me.
    Thank you
    arif

  2. #2
    Guest
    Why don't you use the FindWindow api instead?

    Code:
    Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    
    Private Sub DetectIE()
    Dim ieframe As Long
    ieframe = FindWindow("ieframe", vbNullString)
    
    If ieframe <> 0 Then
    MsgBox "IE Found!"
    Else
    MsgBox "IE Not Found!"
    End If
    End Sub
    
    Usage:
    
    Call DetectIE

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    KL, Malaysia
    Posts
    7
    Thanks Matthew,
    But actually I need to use GetObject so that I can use MyIE object to navigate. My objective is to detect the current IE homepage which is already open by the user, save the page and go back to the previous page, put password etc.

    Below is a little bit detail of my code.

    Sub DetectIE()
    Dim MyIE As Object

    On Error GoTo NoIE
    Set MyIE = GetObject(, "InternetExplorer.Application")
    MsgBox "IE found"


    MyIE.Visible = True
    MyIE.Navigate "https://www.tm.net.my"
    Do Until MyIE.ReadyState = READYSTATE_COMPLETE
    DoEvents
    Loop

    'Put login name and password
    Call Authenticate
    Do Until MyIE.ReadyState = READYSTATE_COMPLETE
    DoEvents
    Loop
    'Copy something to the homepage from Excel
    Call CopyAllAtOnce

    Exit Sub

    NoIE:
    MsgBox "IE not found"

    End Sub


    arif

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