|
-
Aug 16th, 2000, 08:44 PM
#1
Thread Starter
New Member
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
-
Aug 16th, 2000, 09:13 PM
#2
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
-
Aug 16th, 2000, 09:52 PM
#3
Thread Starter
New Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|