Full Version: ActiveX web browser control
UtterAccess Forums > Microsoft® Access > Access Forms
I am using the ActiveX web browser contol on one of my forms and it works well. What I'd like to know is there any way to add the web browser control toolbar to the browser or the form? I want the (back, forward, refresh, ect.) buttons that are on a typical IE page. Why would they beulid a web broswer and not put the controls on it in some way? Am I missing a property setting? Or do I have to put command buttons on the form and then code them in some way to make them do what I want to the web browser control (what a pain)?
I believe that there is no way to make the default toolbar/menubar/addressbar/statusbar etc. appear, even though the OCX exposes properties for them.

You have to create these functionalities yourself.

BTW, this is not a web browser that was "built"; it just exposes certain functionalities of IE and allows them to be embedded in a form. If you want a full web browser, you can always launch the real thing.
This reference link may be of some help to you:
I am attaching an Access 2000 database which I use and has internet explorer features you have requested. When the database is opened, Utter Access is the default web page that opens. You can adjust this by going into the forms OnOpen event and change it to whatever you want it to.
lso, you will need to have the references set to Microsoft Internet Controls in order for this to work.
That is Exactly what I was looking for! Thank you VERY much.
You're welcome. Good luck with your project. thumbup.gif
This is a nice sample. You have created a lot of the basic functionalities of the standard IE toolbar; with a little work, you could probably even emulate more of the standard IE "look".
You should consider posting this in the CODE ARCHIVE here at UA.
Thank you. I sure can post it in the archives especially if it will help other people. I am going to work on it a little more and see how much more functionality I can add before I put it out to the UA community.
I found a way to emulate the address bar so that it will show the page that it is currently on. In the form's OnTimer event put the timer interval to 1 so it does it every 1 second. Then in the code for the timer put this in:
Private Sub Form_Timer()
Dim sURL As String

If sURL <> BrowserObject.LocationURL Then
sURL = BrowserObject.LocationURL
AddressBarTextBox = sURL
End If

End Sub

Pretty simple, makes it so that if sURL isn't up to date then it updates it and pushes the value to the AddressBar. Enjoy frown.gif and good luck on your project.
A TimerInterval of 1 will fire every 1/1000 of a second. If you want it to fire once a second, use a TimerInterval of 1000.
think a better way to do this, though, would be to use one of the control's events, such as DOWNLOADCOMPLETE or NAVIGATECOMPLETE2, so it will just fire when needed, rather than needing to have code continuously running. For example, modifying the DOWNLOADCOMPLETE in the sample in this thread:
Public Sub webspace_DownloadComplete()
  Me!lblStatusDL.Caption = "Ready."
  Me!Text19 = webspace.LocationURL
End Sub

For (it "feels" better to me here, in terms of when the control gets updated):
Private Sub webspace_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
  Me!Text19 = webspace.LocationURL
End Sub
Even better frown.gif I am barely learning how to code VBA and I only learn by trial and error.. I will change mine to reflect your code.. thanks for the input.
If it's of any use, I've attached a ZIP file with some of the WindowsXP icons from the IE toolbar.
Cool. Thanks. I will definitely make use of them. Thanks to you and Brandon for the code example. I will use it as well. thumbup.gif
I realized I left out the DISABLED versions for BACK and FORWARD ... the attached file has them, as well.
Hello, people.
thank's for the samples.
Is there a way to get a command button or else to call my favorites, in the web browser form.
I've tried to open .url files in my favorites but they open in IE and not in the web browser form.
Can you help me please.
Welcome to UA!
How exactly are you doing this?
HE favorites is a folder on your hard drive; you could likely read through the files in that directory using Access code (for example, using the DIR function), and build a combobox or something that could send its links to the Access form. Of course, folders within your favorites folder would have to be handled. You could get all fancy and write a treeview popup form or something, if you wanted.
The general location for Favorites is:
C:\documents and settings\<username>\Favorites
but may vary depending on your setup.
Just curious as to why you want to duplicate this functionality in an Access form, though. Seems that if you need the full IE interface, it would be simpler to just launch IE. A web browser control in an Access form is just that; it doesn't become your default browser where links will be launched. It can only do what you code it to do.
thank's peter.
You're right, maybe i don't need to have all my favorites in my access form, just some of them, and for that i did'nt need help. I just thought that was easy to do it, with some control, and if it doesn't, forget it.
Thank's again.
if want to know how did i open .url files from command button, just tell me, and i send you a copy with the example code.
João Lourenço Medeiros
I know how to issue a FollowHyperlink command, I was wondering if that was how you were doing it, since you did not specify. That command uses the shell to do its executes, so it will call the default browser.
o navigate to a known URL using the ActiveX WebBrowser control, the code is:
Me!nameofwebactivexcontrol.Navigate "http://yoururlgoeshere"
THere is a function that will populate a two-column, value-list combobox with URL's from the current user's favorites folder:
Public Function fncURLList(pstrPath As String) As String
  Dim strName As String, strRetVal As String, strTemp As String, strURL As String
  Dim intFile As Integer
  strName = Dir(pstrPath, vbNormal)
  Do While strName <> ""
    intFile = FreeFile
    Open (pstrPath & "\" & strName) For Input As #intFile
    Line Input #intFile, strURL
    Line Input #intFile, strURL
    Close #intFile
    If strURL <> "" Then
      strTemp = ";" & Replace(Left(strName, Len(strName) - 4), ";", "") & ";" & Replace(Mid(strURL, 9), ";", "%3B")
      If Len(strRetVal & strTemp) <= 2048 Then strRetVal = strRetVal & strTemp ' Access 2000 can only hold 2048 characters in a ValueList combobox
    End If
    strName = Dir
  fncURLList = Mid(strRetVal, 2)
End Function

You would call it as such (in your form's open event):
Me.cboFavorites.RowSource = fncURLList(Environ("UserProfile") & "\Favorites\")
And, of course, you would need something in the AFTERUPDATE event of that combo to set the URL:
Me!nameofwebcontrol.Navigate cboFavorites.Column(1)
Note that this is really just a demo to get you started on how to do it; it ignores any folders in the favorites directory, and, since Access 2000 has a maximum of 2048 characters that can be the source of a value-list combobox, it will stop adding favorites to the list at that point. It does demonstrate a method by which this could be done; hope it is enough to get you started.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.