Webbrowser Control Script Error (1 Viewer)

silentwolf

Active member
Local time
Today, 08:34
Joined
Jun 12, 2009
Messages
559
Hi guys,

I am just trying out a webbrowser control in a form.

Code:
Dim WithEvents objWebbrowser As WebBrowser
'

Private Sub cmdLoad_Click()
    'Eine Internetseite  lesen
    objWebbrowser.Navigate "https://www.access-programmers.co.uk"
   
End Sub

Private Sub ctlWebbrowser_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
    'Wenn fergiggeladen, Meldung ausgeben
    MsgBox objWebbrowser.LocationURL
End Sub

Private Sub Form_Open(Cancel As Integer)
    'Zuweisung des Objektverweises beim Öffnen des Formulares
    Set objWebbrowser = Me!ctlWebbrowser.Object
End Sub

Private Sub Form_Close()
    'Zerstören des Objektverweises beim Schließen
    Set objWebbrowser = Nothing
End Sub

when I open the form I get a script Error Message or better to say a few three or four messages..

What does that mean and what do I need to change to prevent this kind of Errors?

Is it in regards to the website I try to open?

P.S. It was not this website ;-)

Many thanks
 

Attachments

  • ScriptError_Nr1.JPG
    ScriptError_Nr1.JPG
    26.2 KB · Views: 272
  • ScriptError_Nr2.JPG
    ScriptError_Nr2.JPG
    25.7 KB · Views: 256
  • ScriptError_Nr3.JPG
    ScriptError_Nr3.JPG
    23.7 KB · Views: 273
  • ScriptError_Nr4.JPG
    ScriptError_Nr4.JPG
    24.7 KB · Views: 259

oleronesoftwares

Passionate Learner
Local time
Today, 08:34
Joined
Sep 22, 2014
Messages
1,159
when I open the form I get a script Error Message or better to say a few three or four messages..
The message is not in English.

If you can translate it to us, you might find someone to point the way forward.
 

silentwolf

Active member
Local time
Today, 08:34
Joined
Jun 12, 2009
Messages
559
Hi,

sorry I did think it is a general type of Error and therefore I did not bother with translation! Was not ment to be rude!

Nr.1 = The object does not support Properties or Methode "addEventListener"

Nr.2="jQuery" is undefined

Nr.3= same as Nr.2

Nr.4='The Property "stringfy" for a undifined or Null reference can not be run or be called

Message
Do you like that the script continue to be run YES NO

I clicked on No gg ;-)

Cheers
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:34
Joined
May 7, 2009
Messages
19,230
move your code from Open event to Load event.
on Open event no control exists yet.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:34
Joined
May 7, 2009
Messages
19,230
you can also Suppress any error messages:

objWebbrowser.Silent = True
 

silentwolf

Active member
Local time
Today, 08:34
Joined
Jun 12, 2009
Messages
559
Hi arnelgp,
thanks for your reply.

Unfortunatelly this does not stop the Errors..
I got this Code out of a "Book" strange that that gives back those errors..
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:34
Joined
May 7, 2009
Messages
19,230
Load event of your form.
 

silentwolf

Active member
Local time
Today, 08:34
Joined
Jun 12, 2009
Messages
559
Ok got it...

Code:
Private Sub cmdLoad_Click()
    'Eine Internetseite  lesen
    objWebbrowser.Navigate "https://www.access-im-unternehmen.de"
End Sub

Private Sub ctlWebbrowser_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
    'Wenn fergiggeladen, Meldung ausgeben
    MsgBox objWebbrowser.LocationURL
End Sub

Private Sub Form_Load()
    'Zuweisung des Objektverweises beim Öffnen des Formulares
    Set objWebbrowser = Me!ctlWebbrowser.Object
        objWebbrowser.Silent = True
End Sub

Private Sub Form_Close()
    'Zerstören des Objektverweises beim Schließen
    Set objWebbrowser = Nothing
End SubPrivate Sub cmdLoad_Click()
    'Eine Internetseite  lesen
    objWebbrowser.Navigate "https://www.access-im-unternehmen.de"
End Sub
 

silentwolf

Active member
Local time
Today, 08:34
Joined
Jun 12, 2009
Messages
559
It seams to work now..

Had to completely close the form in order to make the code work.

As I mentioned I find it a little strange that the autor did not came accross this issue.
Or is this not something that happens regulary?

I mean the Errors if the code is writen as it was?

Cheers
 

silentwolf

Active member
Local time
Today, 08:34
Joined
Jun 12, 2009
Messages
559
Just one question to this thread.

Is it save to use those controls on an application or is there a better way of displaying a webside on a form?
 

Users who are viewing this thread

Top Bottom