Ask Question Forum:
Model Library:2025-02-08:A.I. model is online auto reply
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by duncanb7
at 2024-07-15 08:39:30
Point:500 Replies:9 POST_ID:828514USER_ID:11059
Topic:
Windows XP Operating System;Programming Languages;Visual Basic Programming
I am using myie.navigate function to go to www.yahoo.com in IE7 In VBA.
And I would like to create second instance in the same IE7 browser, and then
also using myie.navigate to go to other website, for example, www.wiki.com
in the second instance I create by setting setcursorpos and mouse_event function in VBA
but it fail because www.wiki.com webpage is going to on the first instance of IE instead of second one.
I want, www.yahoo.com is going to the first instanc and www.wiki.com is going to the second instance
of IE7 within the same IE7 browser
The first question:
how to create second instance of IE7 when IE7 new broswer is created successfully in VBA, in VBA ?
And now I am using setcursorpos() and mouse_event function to click out the second instance in
the IE broswer
The second question:
I am tring the following code but it just always www.wiki.com is replacing www.yahoo.com in the
first instance of IE, I want, www.yahoo.com is going to the first instant and www.wiki.com is going to the second instance of IE7 within the same IE7 broswer
And I try to use myie.LocationURL=http://www.wiki.com" to replace second instance's URL address
it always report property error from VBA
Please advise with the following VBA code
Duncan
And I would like to create second instance in the same IE7 browser, and then
also using myie.navigate to go to other website, for example, www.wiki.com
in the second instance I create by setting setcursorpos and mouse_event function in VBA
but it fail because www.wiki.com webpage is going to on the first instance of IE instead of second one.
I want, www.yahoo.com is going to the first instanc and www.wiki.com is going to the second instance
of IE7 within the same IE7 browser
The first question:
how to create second instance of IE7 when IE7 new broswer is created successfully in VBA, in VBA ?
And now I am using setcursorpos() and mouse_event function to click out the second instance in
the IE broswer
The second question:
I am tring the following code but it just always www.wiki.com is replacing www.yahoo.com in the
first instance of IE, I want, www.yahoo.com is going to the first instant and www.wiki.com is going to the second instance of IE7 within the same IE7 broswer
And I try to use myie.LocationURL=http://www.wiki.com" to replace second instance's URL address
it always report property error from VBA
Please advise with the following VBA code
Duncan
Sub testIE()dim myIE As SHDocVw.InternetExplorerSet myIE = CreateObject("InternetExplorer.Application")Set myIE = New InternetExplorerWith myIE .Visible = True.navigate "http://www.yahoo.com"sleep(5000)SetCursorPos 445, 304 'create second instance in myIE IE7 objectsleep(100)mouse_event MOUSEEVENTF_leftDOWN, 0, 0, 0, 0mouse_event MOUSEEVENTF_leftUP, 0, 0, 0, 0sleep(1000)'second instance is created by mouse event and setcursor'now go to other website on the second instance.navigate "http://www.wiki.com" "the www.wiki.com will go to first instance instead of second instance' .LocationURL="http://www.wiki.com" ' it also fail with VBA runtime errorEnd withEnd Sub 1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17:18:19:
Author: duncanb7 replied at 2024-07-15 09:26:14
For my memo, for the following sub that also works and simple
Sub testIE2()
Dim myIE As SHDocVw.InternetExplorer
Set myIE = CreateObject("InternetExplorer.Application")
Set myIE = New InternetExplorer
With myIE
.Visible = True
.navigate "http://www.yahoo.com"
.Navigate "http://www.wiki.com", Nothing, "_blank"
End With
End Sub
Sub testIE2()
Dim myIE As SHDocVw.InternetExplorer
Set myIE = CreateObject("InternetExplorer.Application")
Set myIE = New InternetExplorer
With myIE
.Visible = True
.navigate "http://www.yahoo.com"
.Navigate "http://www.wiki.com", Nothing, "_blank"
End With
End Sub
Author: duncanb7 replied at 2024-07-15 09:11:00
Thanks for your quick reply
to trigger the final answer of this
thread
Duncan
to trigger the final answer of this
thread
Duncan
Author: duncanb7 replied at 2024-07-15 09:10:03
after google to http://www.xtremevbtalk.com/archive/index.php/t-310263.html
and similar answer as yours and I run the following test, it passed
and create two instance with two different webiste in the same IE7 browser
Sub testIE()
Const navOpenInNewTab = &H800
Dim myIE As SHDocVw.InternetExplorer
Set myIE = CreateObject("InternetExplorer.Application")
Set myIE = New InternetExplorer
With myIE
.Visible = True
.navigate "http://www.yahoo.com"
.Navigate2 "http://www.wiki.com", CLng(navOpenInNewTab)
End With
End Sub
and similar answer as yours and I run the following test, it passed
and create two instance with two different webiste in the same IE7 browser
Sub testIE()
Const navOpenInNewTab = &H800
Dim myIE As SHDocVw.InternetExplorer
Set myIE = CreateObject("InternetExplorer.Application")
Set myIE = New InternetExplorer
With myIE
.Visible = True
.navigate "http://www.yahoo.com"
.Navigate2 "http://www.wiki.com", CLng(navOpenInNewTab)
End With
End Sub
Assisted Solution
Expert: HainKurt replied at 2024-07-15 08:59:27
250 points EXCELLENT
have a look at this
http://msdn.microsoft.com/en-us/library/aa752093(v=VS.85).aspx
http://msdn.microsoft.com/en-us/library/aa752094(v=VS.85).aspx
and flags
http://msdn.microsoft.com/en-us/library/dd565688(v=VS.85).aspx
Enum BrowserNavConstants
navOpenInNewWindow = 1
...
navOpenInNewTab = 2048
navOpenInBackgroundTab = 4096
...
navVirtualTab = 16384
...
End Enum
http://msdn.microsoft.com/en-us/library/aa752093(v=VS.85).aspx
http://msdn.microsoft.com/en-us/library/aa752094(v=VS.85).aspx
and flags
http://msdn.microsoft.com/en-us/library/dd565688(v=VS.85).aspx
Enum BrowserNavConstants
navOpenInNewWindow = 1
...
navOpenInNewTab = 2048
navOpenInBackgroundTab = 4096
...
navVirtualTab = 16384
...
End Enum
Author: duncanb7 replied at 2024-07-15 08:58:54
I'm using 2003 Excel VBA in window XP with IE7 , the
dim navOpenInBackgroundTab = 0x1000;
set oIE = new ActiveXObject("InternetExplorer.Application")
The two code is reported syntax error , Why ?
dim navOpenInBackgroundTab = 0x1000;
set oIE = new ActiveXObject("InternetExplorer.Application")
The two code is reported syntax error , Why ?
Accepted Solution
Expert: HainKurt replied at 2024-07-15 08:56:33
250 points EXCELLENT
ok try this:
dim navOpenInBackgroundTab = 0x1000;
set oIE = new ActiveXObject("InternetExplorer.Application")
oIE.Navigate2("http://www.site1.com")
oIE.Navigate2("http://www.site2.com")
oIE.Visible = true
dim navOpenInBackgroundTab = 0x1000;
set oIE = new ActiveXObject("InternetExplorer.Application")
oIE.Navigate2("http://www.site1.com")
oIE.Navigate2("http://www.site2.com")
oIE.Visible = true
Author: duncanb7 replied at 2024-07-15 08:53:14
I want the two website in the same IE browser,
From your code, it might create two seperate IE windows browser, is it right ?
From your code, it might create two seperate IE windows browser, is it right ?
Author: duncanb7 replied at 2024-07-15 08:52:03
'myie.LocationURL="http://www.wiki.com" ' it also fail with VBA runtime error
It will report error in VBA, I try to use LocationURL with if or do until condition statement it will be okay
but it can not be synatx like this
myie-LocationURL="http://www.wiki.com"
It will report error in VBA, I try to use LocationURL with if or do until condition statement it will be okay
but it can not be synatx like this
myie-LocationURL="http://www.wiki.com"
Expert: HainKurt replied at 2024-07-15 08:48:45
create two object
dim myIE1 As SHDocVw.InternetExplorerSet myIE1 = CreateObject("InternetExplorer.Application")Set myIE1 = New InternetExplorerdim myIE2 As SHDocVw.InternetExplorerSet myIE2 = CreateObject("InternetExplorer.Application")Set myIE2 = New InternetExplorerWith myIE ... ' .LocationURL="http://www.wiki.com" ' it also fail with VBA runtime errorEnd withWith myIE ... ' .LocationURL="http://www.google.com" ' it also fail with VBA runtime errorEnd with 1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17: