ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   run Internet explorer in VBA 2007 (EXCEL) (https://www.excelbanter.com/excel-programming/422010-run-internet-explorer-vba-2007-excel.html)

Dean[_2_]

run Internet explorer in VBA 2007 (EXCEL)
 
Hello, I am new to VBA and was just woundering if it is possible to
add a control on to a userform, where you can use the internet, I
looked at microsoft web browser control, but I am not sure how to do
it, could you help? Thanks

Harald Staff[_2_]

run Internet explorer in VBA 2007 (EXCEL)
 
Yep, very possible, and the webbrowser control is the way to go. But it's
just a reading pane, you must provide and code all browserbuttons and -menus
you would need.
If you're new to VBA, I suggest you don't start with this project, learn the
basics first.

Best wishes Harald

"Dean" wrote in message
...
Hello, I am new to VBA and was just woundering if it is possible to
add a control on to a userform, where you can use the internet, I
looked at microsoft web browser control, but I am not sure how to do
it, could you help? Thanks



Dean[_2_]

run Internet explorer in VBA 2007 (EXCEL)
 
On Jan 6, 11:40*pm, "Harald Staff" wrote:
Yep, very possible, and the webbrowser control is the way to go. But it's
just a reading pane, you must provide and code all browserbuttons and -menus
you would need.
If you're new to VBA, I suggest you don't start with this project, learn the
basics first.

Best wishes Harald

"Dean" wrote in message

...



Hello, I am new to VBA and was just woundering if it is possible to
add a control on to a userform, where you can use the internet, I
looked at microsoft web browser control, but I am not sure how to do
it, could you help? Thanks- Hide quoted text -


- Show quoted text -


ok sure maybe I'm not that new, But i'm not the professional type

Harald Staff[_2_]

run Internet explorer in VBA 2007 (EXCEL)
 
Good. Set your VB editor to "Require variable declaration" so that it enters
Option Explicit into your modules.
Add the control to a userform and the top dropdowns + intellisense will
reveal all properties and methods you need to get started. Here are the
important five. Add Textbox1 (for URL entry). Commandbutton1 ("Go") and
Commandbutton2 ("Back"):

Option Explicit

Private Sub CommandButton1_Click()
WebBrowser1.Navigate2 (Me.TextBox1.Text)
End Sub

Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, _
URL As Variant, Flags As Variant, _
TargetFrameName As Variant, PostData As Variant, _
Headers As Variant, Cancel As Boolean)
Me.Caption = "Loading " & URL
End Sub

Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As
Variant)
Me.Caption = "Done"
End Sub

Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
Me.Caption = Text
End Sub

Private Sub CommandButton2_Click()
WebBrowser1.GoBack
End Sub

The control is useful for more than webbrowsing, see Dick's articles on
http://www.dailydoseofexcel.com/?s=webbrowser+control

HTH. Best wishes Harald


"Dean" wrote in message
...
On Jan 6, 11:40 pm, "Harald Staff" wrote:
Yep, very possible, and the webbrowser control is the way to go. But it's
just a reading pane, you must provide and code all browserbuttons
and -menus
you would need.
If you're new to VBA, I suggest you don't start with this project, learn
the
basics first.

Best wishes Harald

"Dean" wrote in message

...



Hello, I am new to VBA and was just woundering if it is possible to
add a control on to a userform, where you can use the internet, I
looked at microsoft web browser control, but I am not sure how to do
it, could you help? Thanks- Hide quoted text -


- Show quoted text -


ok sure maybe I'm not that new, But i'm not the professional type


Dean[_2_]

run Internet explorer in VBA 2007 (EXCEL)
 
On Jan 7, 3:33*pm, "Harald Staff" wrote:
Good. Set your VB editor to "Require variable declaration" so that it enters
Option Explicit into your modules.
Add the control to a userform and the top dropdowns + intellisense will
reveal all properties and methods you need to get started. Here are the
important five. Add Textbox1 (for URL entry). Commandbutton1 ("Go") and
Commandbutton2 ("Back"):

Option Explicit

Private Sub CommandButton1_Click()
WebBrowser1.Navigate2 (Me.TextBox1.Text)
End Sub

Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, _
* * URL As Variant, Flags As Variant, _
* * TargetFrameName As Variant, PostData As Variant, _
* * Headers As Variant, Cancel As Boolean)
Me.Caption = "Loading " & URL
End Sub

Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As
Variant)
Me.Caption = "Done"
End Sub

Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
Me.Caption = Text
End Sub

Private Sub CommandButton2_Click()
WebBrowser1.GoBack
End Sub

The control is useful for more than webbrowsing, see Dick's articles onhttp://www.dailydoseofexcel.com/?s=webbrowser+control

HTH. Best wishes Harald

"Dean" wrote in message

...
On Jan 6, 11:40 pm, "Harald Staff" wrote:





Yep, very possible, and the webbrowser control is the way to go. But it's
just a reading pane, you must provide and code all browserbuttons
and -menus
you would need.
If you're new to VBA, I suggest you don't start with this project, learn
the
basics first.


Best wishes Harald


"Dean" wrote in message


....


Hello, I am new to VBA and was just woundering if it is possible to
add a control on to a userform, where you can use the internet, I
looked at microsoft web browser control, but I am not sure how to do
it, could you help? Thanks- Hide quoted text -


- Show quoted text -


ok sure maybe I'm not that new, But i'm not the professional type- Hide quoted text -

- Show quoted text -


Hey! thanks alot, not I am planning to add a list box for the hitory,
should I just use additem when you click the Go button, that shouldn't
be too hard, well once again, thanks

Harald Staff[_2_]

run Internet explorer in VBA 2007 (EXCEL)
 
"Dean" wrote in message
news:7117a377-22c8-4c6d-98aa- ...
Hey! thanks alot, not I am planning to add a list box for the hitory,
should I just use additem when you click the Go button, that shouldn't
be too hard, well once again, thanks


You're welcome.
Hard part would then be to save the history between excel shutdowns /
computer reboots. Do this by writing to / reading from a text file, ini
file, xml file, database, worksheet or similar. Web is full of samples.
Consider also not to save "Go" entries that are invalid -check the other
events for that. Maybe NavigateComplete2 or StatusTextChange is the place to
save instead.

Best wishes Harald


Dean[_2_]

run Internet explorer in VBA 2007 (EXCEL)
 
On Jan 9, 2:35*am, "Harald Staff" wrote:
"Dean" wrote in message
news:7117a377-22c8-4c6d-98aa- ....
Hey! thanks alot, not I am planning to add a list box for the hitory,
should I just use additem when you click the Go button, that shouldn't
be too hard, well once again, thanks


You're welcome.
Hard part would then be to save the history between excel shutdowns /
computer reboots. Do this by writing to / reading from a text file, ini
file, xml file, database, worksheet or similar. Web is full of samples.
Consider also not to save "Go" entries that are invalid -check the other
events for that. Maybe NavigateComplete2 or StatusTextChange is the place to
save instead.

Best wishes Harald


oh, ok thanks
yea got the code to read and write .txt files on my other computer
but that is somewhere else


All times are GMT +1. The time now is 05:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com