+ Reply to Thread
Results 1 to 2 of 2

Reference problem

  1. #1
    RB Smissaert
    Guest

    Reference problem

    Have a commerial .xla add-in and some (2 or 3) customers have come across a
    problem that somehow has to do with
    References, but I can't understand what the problem is.
    I have a VB6 dll, called RCBrowser.dll and this will load a VB6 form and run
    some related code.
    The reference to this dll is set fine in the add-in, but the .xla behaves as
    if this reference is missing.

    This is the bit in the .xla code where it falls over:
    ------------------------------------------------------------------------

    Dim clsRCB As RCBrowser.clsRCBrowser
    Set clsRCB = New RCBrowser.clsRCBrowser

    Set clsRCB.ExcelApp = Application

    It falls over at the last line. I haven't got the exact error message, but
    it is as if it thinks the reference is missing.


    This is the relevant bit (I think) in the VB6 code:
    ------------------------------------------------------------------------

    Option Explicit
    Private Const GWL_HWNDPARENT As Long = -8
    Private mxlApp As Excel.Application
    Private mlXLhWnd As Long
    Private Declare Function FindWindow _
    Lib "user32" _
    Alias "FindWindowA" _
    (ByVal lpClassName As String, _
    ByVal lpWindowName As String) As Long
    Private Declare Function SetWindowLong _
    Lib "user32" _
    Alias "SetWindowLongA" _
    (ByVal hWnd As Long, _
    ByVal nIndex As Long, _
    ByVal dwNewLong As Long) As Long

    Public Property Set ExcelApp(ByRef xlApp As Excel.Application)
    Set mxlApp = xlApp
    mlXLhWnd = FindWindow(vbNullString, mxlApp.Caption)
    End Property


    Public Sub ShowVB6Form()

    Set frmRCB = New frmRCBrowser

    Load frmRCB
    SetWindowLong frmRCB.hWnd, GWL_HWNDPARENT, mlXLhWnd
    frmRCB.Show 0

    End Sub


    All this worked fine before.
    I tried running regsvr32 and I have tried bringing the file MSCOMCTL.OCX up
    to date, but all to
    no avail.
    I am probably overlooking something simple here and not having seen the
    troublesome machine myself doesn't help
    but I am running out of ideas what could be the problem here.

    Thanks for any advice.


    RBS


  2. #2
    RB Smissaert
    Guest

    Re: Reference problem

    Ignore this.
    It appeared it was just a corrupted dll file.

    RBS

    "RB Smissaert" <[email protected]> wrote in message
    news:[email protected]...
    > Have a commerial .xla add-in and some (2 or 3) customers have come across
    > a problem that somehow has to do with
    > References, but I can't understand what the problem is.
    > I have a VB6 dll, called RCBrowser.dll and this will load a VB6 form and
    > run some related code.
    > The reference to this dll is set fine in the add-in, but the .xla behaves
    > as if this reference is missing.
    >
    > This is the bit in the .xla code where it falls over:
    > ------------------------------------------------------------------------
    >
    > Dim clsRCB As RCBrowser.clsRCBrowser
    > Set clsRCB = New RCBrowser.clsRCBrowser
    >
    > Set clsRCB.ExcelApp = Application
    >
    > It falls over at the last line. I haven't got the exact error message, but
    > it is as if it thinks the reference is missing.
    >
    >
    > This is the relevant bit (I think) in the VB6 code:
    > ------------------------------------------------------------------------
    >
    > Option Explicit
    > Private Const GWL_HWNDPARENT As Long = -8
    > Private mxlApp As Excel.Application
    > Private mlXLhWnd As Long
    > Private Declare Function FindWindow _
    > Lib "user32" _
    > Alias "FindWindowA" _
    > (ByVal lpClassName As String, _
    > ByVal lpWindowName As String) As Long
    > Private Declare Function SetWindowLong _
    > Lib "user32" _
    > Alias "SetWindowLongA" _
    > (ByVal hWnd As Long, _
    > ByVal nIndex As Long, _
    > ByVal dwNewLong As Long) As Long
    >
    > Public Property Set ExcelApp(ByRef xlApp As Excel.Application)
    > Set mxlApp = xlApp
    > mlXLhWnd = FindWindow(vbNullString, mxlApp.Caption)
    > End Property
    >
    >
    > Public Sub ShowVB6Form()
    >
    > Set frmRCB = New frmRCBrowser
    >
    > Load frmRCB
    > SetWindowLong frmRCB.hWnd, GWL_HWNDPARENT, mlXLhWnd
    > frmRCB.Show 0
    >
    > End Sub
    >
    >
    > All this worked fine before.
    > I tried running regsvr32 and I have tried bringing the file MSCOMCTL.OCX
    > up to date, but all to
    > no avail.
    > I am probably overlooking something simple here and not having seen the
    > troublesome machine myself doesn't help
    > but I am running out of ideas what could be the problem here.
    >
    > Thanks for any advice.
    >
    >
    > RBS



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1