Results 1 to 4 of 4

Thread: webbrowser help

  1. #1
    Join Date
    Aug 2006
    Location
    Baltimore
    Posts
    2

    Unhappy Unanswered: webbrowser help

    Hello all, I hope you can help. I've grepped for this answer and I'm about stumped.

    I am writting an excel application that records an employees time. This is easy so far. I added a webbrowser control to the spreadsheet so that clicking a button or selecting a menu item will open the browser and take our dutiful employee to our companies time recording login page.

    My issue is that this pages form has a target="_blank" which will open a new browser window. My code looks like this

    Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
    Dim frm As New UserForm1
    Dim strUrl As String
    Dim htmldoc As HTMLDocument
    Set htmldoc = WebBrowser1.Document

    frm.WebBrowser1.RegisterAsBrowser = True
    Set ppDisp = frm.WebBrowser1.Object
    frm.Show
    End Sub

    My problem is that I get an error 438 "Object doesn't support this property or method" on this line of code
    ==> Set ppDisp = frm.WebBrowser1.Object

    I'm not sure why this is occurring as every example on how to do this has the identical code.

    I'm using excel 2003 on Windows xp professional

    Any help would be appreciated.

  2. #2
    Join Date
    Jun 2006
    Posts
    103
    Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
    Dim frm As New userform1

    Dim strUrl As String
    Dim htmldoc As HTMLDocument
    Set htmldoc = WebBrowser1.Document

    frm.WebBrowser1.RegisterAsBrowser = True
    Set ppDisp = frm.WebBrowser1.Object
    frm.Show
    End Sub


    Dim frm As New userform1
    Dim htmldoc As HTMLDocument
    look at these two things you declare

    frm is a type of userform1, i suspect this is the person who code this self make, you might need a class module which name is userform1, where you got this code from? This is probably why you got object not declare error

    htmldoc i think you might solve the problem already which it need to include a reference Microsoft HTML Object Library

  3. #3
    Join Date
    Aug 2006
    Location
    Baltimore
    Posts
    2

    More questions?

    mkggoh
    So what your saying is that
    Dim frm As New userform1
    probably refers to a class named frm?

    I'm confused by your statement....
    "htmldoc i think you might solve the problem already which it need to include a reference Microsoft HTML Object Library"

    Would you mind elaborating for me?

  4. #4
    Join Date
    Jun 2006
    Posts
    103
    Quote Originally Posted by kepha
    mkggoh
    So what your saying is that
    Dim frm As New userform1
    probably refers to a class named frm?

    I'm confused by your statement....
    "htmldoc i think you might solve the problem already which it need to include a reference Microsoft HTML Object Library"

    Would you mind elaborating for me?
    yes, for HTML Object Library, you can check by choosing the menu bar on the window where you write vba code, go Tools-->References, check if Microsoft HTML Object Library has been selected, if not you need to select it and click OK button.

    for this userform1 type. Microsoft does not provide this user type. someone might created it him/her self, so to verify, you need to ask the author of the code to have more information.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •