Activex control web browser Results

Hey guys,

Is there any way to resize an ActiveX web browser control on a form with vba? I've got my form resizing using the module floating around the internet by Jamie Czernik, and that works great, but it doesn't resize my web browser. I also tried

	Code:
	    Me.WebBrowser0.Width = 17775
    Me.WebBrowser0.Height = 9375

on the forms On Load event, but still nothing. We're trying to keep the form the same no matter what the screen resolution. Any thoughts?

Ok, I built a database which stores employee information and allows users to to attach pdf documents to employee records. Files are not stored in the DB only paths. I have a document viewer form that displays the pdfs using the ActiveX webbrowser control. Now everything works fine on my machine. But when one of our employees clicks the browse button and selects the pdf, its opens up in adobe reader instead of the web browser. I don't think the code is the problem, I think it maybe a setting on her computer. Any help is appreciated, I am leaving the country in 24hrs and would like this resolved before then.

This is the code used to display the document.

Private Sub Command_Browse_Click()
On Error GoTo err:

Dim fDialog As Office.FileDialog
Dim varFile As Variant

Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.Title = Title
.AllowMultiSelect = False
.Filters.Clear
.Filters.Add "PDF Files", "*.pdf"

'Show the dialog box. If the .Show method returns True, the
'user picked at least one file. If the .Show method returns
'False, the user clicked Cancel.
If .Show = True Then
Me.Text_LoadPath = .SelectedItems(1)
objIE.Navigate Me.Text_LoadPath

Else
'MsgBox "You clicked Cancel in the file dialog box."

End If
End With

err:
Select Case err.Number
Case 0
'No error
Case 91
Set objIE = Me.WebBrowser0.Object
objIE.Navigate Me.Text_LoadPath
Resume Next
Case 424
Set objIE = Me.WebBrowser0.Object
objIE.Navigate Me.Text_LoadPath
Resume Next
Case Else
MsgBox "An unhandled error has occurred." & vbNewLine & _
"Location: frmViewDocument" & vbNewLine & _
"Module: Command_Cancel_Click " & vbNewLine & _
err.Number & vbNewLine & _
err.Source & vbNewLine & _
err.Description, vbCritical, "Unhandled Exception"

End Select




End Sub

I am trying to use the Web Browser ActiveX Control to preview PDF files within my application. I did this a long time ago without problems (Access 97) and the examples I have found online are all straightforward:


	Code:
	objWebCtrl.Navigate=strPath

Unfortunately, Access 2010 does not appear to realize that the Web Control has a navigate method. I keep getting the following run-time error: Object doesn't support this property or method.

Has the way you interact with this particular ActiveX control changed or is there something I am doing wrong?

Hello, all.
I'm working on a small-to-mid-scale database for a commercial bank which is currently in a beta state, but still has room for improvement. One of my main issues is regarding a web browser object that appears embedded into a few of the forms in the database. This web browser is set to navigate through a specific website that delivers pertinent information to the user as they do their job. The problem is, this website requires authentication and it maintains this authentication by SESSID. The other problem is that these forms are being opened and closed pretty regularly by the user and when a form is unloaded, the controls are destructed and I lose my session ID. That is to say, when they reopen the form a few minutes later, they have to log in again.

My idea to circumvent this issue is to define a webbroswer object dynamically at a module level and then apply this object to each form in Form_Load. That way, the control is not destructed until I destroy it and the SESSID should be maintained the entire time. This will also allow me to more easily maintain the state of the browser between each form.

So... I guess I'm just asking a fairly simple syntax question. Does anyone here know how to add a WebBrowser object to a form or set a dynamic WebBrowser object to a static ActiveX control already placed on the form?

I've been playing with an Active X Web Browser and I haven't been able to find a good library for ActiveX Controls so I've been pretty limitted with what I can do.
So far I've picked up the Navigate and the innertext bits from here, but I'm curious if anyone has a good place to go to find code that deals with active x controls.

Specifically I'm trying to find a way to force a user to wait until a page is loaded before using a form. I found a sub on the MSDN site, NavigateComplete2 but it doesn't seem to be supported in VBA. Anyone have any tips?

I am designing a form in 2010. I was looking for the namtive web browser control and can't seem to locate it.
All I can find is the ActiveX control, but I want to use the Native control.

Anyone know where it is and how I can place it on my form?

Thanks in advance.

Hi Everyone,

I have inherited an Excel application which incorporates a little (rather nice) Web Browser display and would like to get this working in MS-Access.

So far I have been able to incorporate an ActiveX Web-Browser Control and am able to call up the basis for the display (a locally stored HTML file). This displays when called with the following syntax ...

Me.WebBrowser1.Navigate ("C:mydirectoryBrowserTest.html")

So far so good.

However, in the Excel application various commands (Javascript) are sent to this HTML file for execution. The syntax is the following ...

Me.WebBrowser1.Document.parentWindow.execScript ("addCoords(51.43, 12.24, 'LEJ')")

In this example coordiates on a map are declared.

But when I try to excute this in Access VBA nothing seems to happen so I am assuming that the calling-syntax is simply not valid. I have tried various other permutations but so far without success.

So can anyone help me out here? How should I send such commands/parameters to the HTML document displayed in my WebBrowser1 window?

Any tips here would be a great help.

Many thanks,
Alan Searle

Hi,

I'm trying to create a report that would use a static map image from Google Maps on each page of the report. I use some GPS coordinates from the database to help generate a URL to show the image from Google in a Web Browser ActiveX control.

Is there a way I can use this ActiveX control on a Report? It works fine in a form.

Or any other solutions to this?

Thanks,

I have a webbrowser control that is used to fetch data from a specific web site.

If the user clicks the 'X' button on the top right the program goes through its routine and closes the form the webbrowser is on. The problem is sometimes when the user does this after a little while (expecially if the website has timers on it) they will get some sort of prompt about the webbrowser is trying to exit and would they like to close it.

I thought when the form was closed all the activex objects were also released from memory but this does not seem to be the case.

So what would be the proper meathod in the on_close event to make sure the activex browser closes or shuts down?

Thanks,
TheChazm

In the object browser for an activeX control I have found an event which at the bottom of the object browser says the following

Quote: Event eventGEEventEmitterClick(object_ As GEEventEmitterCoClass,
capturePhase_ As Long, event As KmlMouseEventCoClass) behind a form I can choose this event and it appears like so

	Code:
	Private Sub GEPluginCoClass3_eventGEEventEmitterClick(ByVal object_ As 
 Object, ByVal capturePhase_ As Long, ByVal event As Object)

I am struggling a little and would like to take this opportunity to understand my object browser better.

What the browser is telling me is that when this event is fired it returns at least two objects the first is "object_" and the second is "event". This means that all the methods available for KmlMouseEventCoClass should be available to me by simply starting with "event"

Thus it means that declaring the object and drilling down to the object is not needed because that is done for me?

Am I on the right track?

And I know you want to know which activeX control it is in my example - it is the Google Earth Plugin. IMO there are no examples of people using the activeX control in VB in this way (there are some in a web browser)- please prove me wrong.

Hey guys,

Is there a way to prevent a link from opening in a new window in an embedded ActiveX web browser control? I'm trying to make a "desktop" app so to speak, where we can access a webpage we use on a regular basis all in one program. It's not a huge problem to keep IE open with access, but it would increase productivity if we could embed the page (one that we pay to use, not something we have built) rather than navigate between access & IE.

Thanks!

I am using a web browser activex control on a form to display the files and folders of a given path like windows explorer.

Is there a way to get the filename of the the user selected file in the control?

Thanks in Advance for any help.

Hi

I can insert a web browser as an ActiveX control however when i view the form in form view no page is displayed. anyone know how i can view the website within a form?

Thanks

Ben

Hi there.

I have an Access Project that interacts with a web browser to perform several functions. We actually open a browser session in 1 of 3 ways:

1. Dimensioning a variable as type Hyperlink and using [variablename].address and .follow
2. Creating an ActiveX control on a form of OLE Class "Microsoft Web Browser" and setting it's value via code as [controlname].Navigate (URL)
3. Using createobject("internetexplorer") to interact with a browser session "silently" or invisibly in the background

I recently upgraded my PC to IE8 and all attempts to utilize the 3rd method above now result in an "automation error". (Truthfully, all attempts to utilize any of the 3 methods above results in an "automation error" if my default browser is set to IE.)

So, my question is... has something changed with IE8 that is causing the problem, or is it just "coincidence" and the real cause of the problem actually lies elsewhere?

Thank you in advance.

For the regulars of the forum you will have noticed the many questions I have had recently for almost non-msaccess things. At the bottom I will put a reference to some of them.

If I were to have a table of places I was wondering how to put them onto the globe, that is Google Earth.

Google first released Google Earth and a COM API. This meant that you could send your table of places to Google earth and have them show up there but meant that it was not in an Access form. You would have two things to look at.

I thought it would be good to take the google earth window and put it (parent it) with a form. I did not find any VBA examples but there are plenty of C# or VB.net examples.

One of my threads below gives a solution to that. I found that it was "clunky" and did not look good as (unlike MS Office programs) when you call google earth it fires VISIBLE and it is hard to hide this before parenting it with your form. Secondly it is a complicated method to resize.

Also you should know that the COM API is not being supported or further developed by Google.

If you do a search for googleearthairlines you will find an activeX control which does this as well.

Solution ".5" is that if you download the Google Earth Plugin for your webbrowser you can reference this and put an activex object (i think that is what I should say it is) on a form. I started here but found that things really did not work very well. This method is also unsupported by Google and you will notice that there are some private funtions that if you read the google forums they say may be taken away in the future (eg to start the API you need start_ so if google takes that away then that would be the end of the story). Form 1 shows a very simple example of this. I could not get the Balloons to work and the click event fires twice.

The final solution uses the web browser control. If you create your own HTML page you can put this into a web browser control and then call the plugin. This has been done in VB.NET and C# but I was not able to find an example in VBA.

I wrote my first HTML and JScript this week so forgive the mess of a HTML file that I have added. Oh and I first start VBA Access about 6 monthd ago as well so this is just a very basic example with no error trapping.

The biggest problem I had was two way communication to and from the web browser control and I hope that by posting my sample one of you experts will guide me a little further on this.

From my form to the webbrowser is not a problem I have the execScript function. But from the webbrowser there is no way in COM. My work around is that if I want to get something from the browser I use Jscript to navigate to a new page, with the page URL being the information that I need. I then capture this in the Beforenavigate event as the URL and then cancel the navigation.

.NET WebBrowser controls have a objectforscripting property which allows this to happen way better. I am guessing that there is someone that could whip up this control as a wrapper exposing this property to COM very very quickly. I would not need spoon feeding but I would have a thousand questions or need an example if someone wants to offer assistance.

here is that question

http://www.access-programmers.co.uk/...d.php?t=168101

I have hard coded a placemark and find address. Google earth API does not do Geocoding (turning an address into Lat/Long) you have to use Google Maps. The Placemark can only be added once as it adds an ID and you can onyl have one ID.

I reference the plugin in the the mdb so you will need to download this from google as well

http://code.google.com/apis/earth/

My todo is work out how to flyto multiple places. Google Earth does this in the form of a tour but the tour is not yet available to the API Plugin.

here the main questions I have had.
http://www.access-programmers.co.uk/...d.php?t=167295
http://www.access-programmers.co.uk/...d.php?t=167345
http://www.access-programmers.co.uk/...d.php?t=167846

**Edit - One thing which you should note is that you can load your .html page locally (ie. from c drive). It appears that in the long term (after testing) this is not the solution that Google wants according to its Terms of Service. In the terms you will see that the implementation of the API must be on a website that is publically available.**

**edit form 1 is left there as an example of how you once could initiate google earth api as a active x control. It does not work with the new version and I am not sure if you can anymore.

**October 2010 - this example is really getting old and I will soon put something in the database examples. It does not work out of the box. Further I made this with Internet Explorer 6...Access will crash if you use IE7 or IE8...you need to delete the Active X control and then put it there again which will then use your IE explorer version. Then name it the same name again in the activeX properties.

see this thread for an explanation until then http://www.access-programmers.co.uk/...18#post1008218

Dear All,

I am currently developing a database system with Access 2000 and wonder if any one could help me with this issue.

Basically this system involves records with images (smaller image or Thumbnail) which need to be shown on a continuous form and a bigger image with the original size will be loaded from another application (IE in this case) by clicking the smaller image. At the moment these smaller images are stored as linked objects in an OLE Object field and displayed in the form using Bound Object Frame control. The links (file path) to bigger images, on the other hand, are stored as text, which can be loaded using shell function when the smaller image is clicked. However, this implementation is not ideal since Access cannot cope with too many images and it's impossible to upsize to SQL Server with those OLE linked objects when the database is getting too large.

I am looking for a way (or any ActiveX Control) which can be bound to a text field containing path to images and loads correct images accordingly when the path exists in a continuous form. I have tried Unbound Object Frame control, Image control and Web Browser control and none of them did this trick in a continuous form. Any tips will be greatly appreciated. Thank you for your help.

Shiang-Lung Dung

Hi again all! I have a form in Access with an ActiveX WebBrowser control in it. What I want is for the user to select some text within the browser, and for that text to be captured in a string variable. I've been scouring the web all day for a clue as to how to do this, and this is all I could find:


	Code:
	Private Sub test_Click()
Dim myText As String
Me.mainBrowser.SetFocus
myText = Me.mainBrowser.Document.activeelement.innertext
Debug.Print myText

End Sub

The problem is, myText is all the text on the entire page. It seems that the ActiveElement is the entire page, even when text in the browser is selected. Does anyone know how I can isolate just the selected text please?


Not finding an answer? Try a Google search.