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-04-14 01:58:49
Point:500 Replies:10 POST_ID:828470USER_ID:11059
Topic:
Hypertext Markup Language (HTML);Visual Basic Programming;Web Browsers
I would like to switch to do automation in VBA from IE7 to Firefox because of speed issue.
I know there is a lot object definiition is bulit for IE such as SHDocVw.InternetExplorer.
now i try to use VBA code for Firefox such as hdlg = Shell("C:Program FilesMozilla Firefoxfirefox.exe " & URL)
but the window handle of hdlg is not matched to the one in WinID or SPy++ so I could not
continue to do other thing. And then I try the following code and method attached form getopenFirefoxbytitle() to grab the
object of Firefox but it also fail. And then I try both two Sub() as follows, it complaint there is no such library for that.
So, I google it , people say needs to download Firefox version Com like Active-X for firefox , otherwise it
is not possible to do any my.nagviate as IE. But How and where to download all neccesay add-on or library
for Firefox or Chrome or Safari ?
Please advise
Duncan
Sub mozilla()
Dim oBr
oBr = CreateObject("FireFox.Application")
oBr.Visible = True
oBr.navigate ("http:www.microsoft.com")
End Sub
Private Sub UserForm_Activate()
Me.MozillaBrowser1.navigate ("http://www.mrexcel.com/board2/viewtopic.php?p=1182388")
End Sub
I know there is a lot object definiition is bulit for IE such as SHDocVw.InternetExplorer.
now i try to use VBA code for Firefox such as hdlg = Shell("C:Program FilesMozilla Firefoxfirefox.exe " & URL)
but the window handle of hdlg is not matched to the one in WinID or SPy++ so I could not
continue to do other thing. And then I try the following code and method attached form getopenFirefoxbytitle() to grab the
object of Firefox but it also fail. And then I try both two Sub() as follows, it complaint there is no such library for that.
So, I google it , people say needs to download Firefox version Com like Active-X for firefox , otherwise it
is not possible to do any my.nagviate as IE. But How and where to download all neccesay add-on or library
for Firefox or Chrome or Safari ?
Please advise
Duncan
Sub mozilla()
Dim oBr
oBr = CreateObject("FireFox.Application")
oBr.Visible = True
oBr.navigate ("http:www.microsoft.com")
End Sub
Private Sub UserForm_Activate()
Me.MozillaBrowser1.navigate ("http://www.mrexcel.com/board2/viewtopic.php?p=1182388")
End Sub
Function GetOpenFirefoxByTitle(i_Title As String, _ Optional ByVal i_ExactMatch As Boolean = True) As SHDocVw.ShellWindowsDim objShellWindows As New SHDocVw.ShellWindows 'If i_ExactMatch = False Then i_Title = "*" & i_Title & "*" 'ignore errors when accessing the document property On Error Resume Next 'loop over all Shell-Windows For Each GetOpenFirefoxByTitle In objShellWindows 'if the document is of type HTMLDocument, it is an IE window If TypeName(GetOpenFirefoxByTitle.document) = "HTMLDocument" Then 'check the title If GetOpenFirefoxByTitle.document.Title = i_Title Then 'leave, we found the right window Debug.Print "found" Debug.Print GetOpenFirefoxByTitle.document.Title & "Found" Exit Function End If End If Debug.Print GetOpenFirefoxByTitle.document.Title & "testing" Next Err.ClearEnd Function 1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17:18:19:20:21:22:23:24:25:
Expert: deanon replied at 2024-07-12 09:06:41
Duncan,
Did you ever find a way to get the control in Firefox that you wanted? I am looking for a way to always navigate the same tab or window.
Thanks,
Dean
Did you ever find a way to get the control in Firefox that you wanted? I am looking for a way to always navigate the same tab or window.
Thanks,
Dean
Author: duncanb7 replied at 2024-04-20 07:50:34
Thanks for your reply
Assisted Solution
Expert: zlatev replied at 2024-04-15 04:38:15
125 points EXCELLENT
Not sure if it will be an overkill, but if it is only for your own use, you may try using Selenium Remote Control http://seleniumhq.org/projects/remote-control/
The Selenium tool will allow you to automate the browser in a way like a real user is working with it.
The Selenium tool will allow you to automate the browser in a way like a real user is working with it.
Assisted Solution
Expert: Chong Yit Seng replied at 2024-04-14 03:09:40
125 points EXCELLENT
Long time never do such programming as my job role changed and never try such automation in FF/Chrome before.
To be frank, IE may be the easier (but slower) solution for you but think can't help you much here to provide you other alternative solutions.
To be frank, IE may be the easier (but slower) solution for you but think can't help you much here to provide you other alternative solutions.
Author: duncanb7 replied at 2024-04-14 02:56:12
I am using 2003 Excel VBA to do automation in IE now , like auto login my bank account and company account.
You know when you go the target page , you might click a lot link and go through a lot message box that is too oweful.
As we know IE web speed is much slower than others like Firefox and Chrom
So I try to switch it FIrefox
You know when you go the target page , you might click a lot link and go through a lot message box that is too oweful.
As we know IE web speed is much slower than others like Firefox and Chrom
So I try to switch it FIrefox
Assisted Solution
Expert: Chong Yit Seng replied at 2024-04-14 02:39:47
125 points EXCELLENT
ActiveX and Com more roled like an add-in component to be integrated into IE, so that it can be used and do certain functions that generally IE cannot do.
However, ActiveX and Com must be installed on the targeted machine before it can be work.
If you know a bit about Java Applet, or even Flash, it's more like a loaded version of add-in in IE, to execute what IE usually can't do.
Those ActiveX/Com/Java Applet are run as a local application in your machine.
So, eventually.. do you mean you want to control the browser you launched from VBA script? if yes, what kind of tasks you wish to accomplish here?
However, ActiveX and Com must be installed on the targeted machine before it can be work.
If you know a bit about Java Applet, or even Flash, it's more like a loaded version of add-in in IE, to execute what IE usually can't do.
Those ActiveX/Com/Java Applet are run as a local application in your machine.
So, eventually.. do you mean you want to control the browser you launched from VBA script? if yes, what kind of tasks you wish to accomplish here?
Author: duncanb7 replied at 2024-04-14 02:22:38
Could you mention a little bit more.
Why people always say COM for IE
Actully, What is Active-X and COM meaing in IE or for other broswers? that is related to the concept even
I could do VBA code for IE, but I never care about that .
Why people always say COM for IE
Actully, What is Active-X and COM meaing in IE or for other broswers? that is related to the concept even
I could do VBA code for IE, but I never care about that .
Expert: Chong Yit Seng replied at 2024-04-14 02:11:14
Think it's same for Chrome or Safari to receive URL as the parameter to launch a webpage.
Expert: Chong Yit Seng replied at 2024-04-14 02:08:01
or you may call the Mozilla Firefox application, and set the URL as a parameter to it...
like:
StartDoc "<installpath>firefox.exe", "http://www.microsoft.com"
like:
StartDoc "<installpath>firefox.exe", "http://www.microsoft.com"
Accepted Solution
Expert: Chong Yit Seng replied at 2024-04-14 02:04:30
125 points EXCELLENT
try use ShellExecute API instead, like:
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Public Function StartDoc(ByVal FileName As String, Optional CommandLine As String = "") As Long
StartDoc = ShellExecute(0&, "Open", FileName, CommandLine, vbNullString, 1)
End Function
then:
StartDoc "http://www.microsoft.com"
It will launch the webpage with your default browser.
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Public Function StartDoc(ByVal FileName As String, Optional CommandLine As String = "") As Long
StartDoc = ShellExecute(0&, "Open", FileName, CommandLine, vbNullString, 1)
End Function
then:
StartDoc "http://www.microsoft.com"
It will launch the webpage with your default browser.