+ Reply to Thread
Results 1 to 4 of 4

Argument not optional Error 449! Need Help

  1. #1
    bad_boyu
    Guest

    Argument not optional Error 449! Need Help

    Hy,

    Let's say I have a dll made in VB6. This dll contains 3 class
    modules(ClassA, ClassB, ClassOper) and one module(MyFunctions).
    In MyFunctions I have a function like this:
    Public Function DoSome(collecFirst as Collection, collecSecond as
    Collection, objA as ClassA, objB as ClassB) as Double.

    In ClassOper I have the function:
    Public Function DoSomething(collecFirst as Collection, collecSecond as
    Collection, objA as ClassA, objB as ClassB) as Double
    If (IsValid) Then
    DoSomething = DoSome(collecFirst, collecSecond, objA,
    objB)
    Else
    DoSomething = -10000
    End Function

    I have an Excel woorkbook that use this dll. Let's say I have a macro
    in Excel called TestDll
    Public Sub TestDll()
    Dim myOper as ClassOper
    Set myOper = New ClassOper
    MsgBox myOper.DoSomething(myCollecFirst, myCollecSecond, myObjA,
    myObjB)
    End Sub
    When trying to run TestDll I get the following error: "argument not
    optional Error 449"

    Can somebody help me with this? (I hope that my example I good..)

    Thanks and best regards,
    O


  2. #2
    Chip Pearson
    Guest

    Re: Argument not optional Error 449! Need Help

    To help determine the exact location of the error, ensure that
    you have your error trapping set to "Break In Class Module". In
    VBA, go to the Tools menu, choose Options, then the General tab.
    Set the "Error Trapping" setting to "Break In Class Module".

    It is most likely that the actual error is within one of the
    classes, and you have your error trapping set to "Break on
    unhandled errors". If you don't have the error trapping set to
    "Break In Class Module", the code will blow up on the line that
    accesses the class, not on the line of code within the class that
    is, in fact, causing the error.


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com




    "bad_boyu" <[email protected]> wrote in message
    news:[email protected]...
    > Hy,
    >
    > Let's say I have a dll made in VB6. This dll contains 3 class
    > modules(ClassA, ClassB, ClassOper) and one module(MyFunctions).
    > In MyFunctions I have a function like this:
    > Public Function DoSome(collecFirst as Collection, collecSecond
    > as
    > Collection, objA as ClassA, objB as ClassB) as Double.
    >
    > In ClassOper I have the function:
    > Public Function DoSomething(collecFirst as Collection,
    > collecSecond as
    > Collection, objA as ClassA, objB as ClassB) as Double
    > If (IsValid) Then
    > DoSomething = DoSome(collecFirst, collecSecond,
    > objA,
    > objB)
    > Else
    > DoSomething = -10000
    > End Function
    >
    > I have an Excel woorkbook that use this dll. Let's say I have a
    > macro
    > in Excel called TestDll
    > Public Sub TestDll()
    > Dim myOper as ClassOper
    > Set myOper = New ClassOper
    > MsgBox myOper.DoSomething(myCollecFirst, myCollecSecond,
    > myObjA,
    > myObjB)
    > End Sub
    > When trying to run TestDll I get the following error: "argument
    > not
    > optional Error 449"
    >
    > Can somebody help me with this? (I hope that my example I
    > good..)
    >
    > Thanks and best regards,
    > O
    >




  3. #3
    bad_boyu
    Guest

    Re: Argument not optional Error 449! Need Help

    Thanks, but I did not manage to find the problem. It is very hard to
    locate the problem, because the Excel workbook use a reference to my
    dll, so I can not use debug.

    Is there a rule when you pass objects and collections to a
    function,procedure?

    Is there a rule when you call a function, procedure that has arguments:
    objects and collections?

    Thanks,
    O


    Chip Pearson wrote:
    > To help determine the exact location of the error, ensure that
    > you have your error trapping set to "Break In Class Module". In
    > VBA, go to the Tools menu, choose Options, then the General tab.
    > Set the "Error Trapping" setting to "Break In Class Module".
    >
    > It is most likely that the actual error is within one of the
    > classes, and you have your error trapping set to "Break on
    > unhandled errors". If you don't have the error trapping set to
    > "Break In Class Module", the code will blow up on the line that
    > accesses the class, not on the line of code within the class that
    > is, in fact, causing the error.
    >
    >
    > --
    > Cordially,
    > Chip Pearson
    > Microsoft MVP - Excel
    > Pearson Software Consulting, LLC
    > www.cpearson.com
    >
    >
    >
    >
    > "bad_boyu" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hy,
    > >
    > > Let's say I have a dll made in VB6. This dll contains 3 class
    > > modules(ClassA, ClassB, ClassOper) and one module(MyFunctions).
    > > In MyFunctions I have a function like this:
    > > Public Function DoSome(collecFirst as Collection, collecSecond
    > > as
    > > Collection, objA as ClassA, objB as ClassB) as Double.
    > >
    > > In ClassOper I have the function:
    > > Public Function DoSomething(collecFirst as Collection,
    > > collecSecond as
    > > Collection, objA as ClassA, objB as ClassB) as Double
    > > If (IsValid) Then
    > > DoSomething = DoSome(collecFirst, collecSecond,
    > > objA,
    > > objB)
    > > Else
    > > DoSomething = -10000
    > > End Function
    > >
    > > I have an Excel woorkbook that use this dll. Let's say I have a
    > > macro
    > > in Excel called TestDll
    > > Public Sub TestDll()
    > > Dim myOper as ClassOper
    > > Set myOper = New ClassOper
    > > MsgBox myOper.DoSomething(myCollecFirst, myCollecSecond,
    > > myObjA,
    > > myObjB)
    > > End Sub
    > > When trying to run TestDll I get the following error: "argument
    > > not
    > > optional Error 449"
    > >
    > > Can somebody help me with this? (I hope that my example I
    > > good..)
    > >
    > > Thanks and best regards,
    > > O
    > >



  4. #4
    Peter T
    Guest

    Re: Argument not optional Error 449! Need Help

    Have you tried running the dll-project code in the VBIDE and stepping
    through. Start with Excel closed, put a break on your entry point, press F5.
    Open your xls and run (normally the ref will pick up the .vbp).

    Regards,
    Peter T

    "bad_boyu" <[email protected]> wrote in message
    news:[email protected]...
    > Thanks, but I did not manage to find the problem. It is very hard to
    > locate the problem, because the Excel workbook use a reference to my
    > dll, so I can not use debug.
    >
    > Is there a rule when you pass objects and collections to a
    > function,procedure?
    >
    > Is there a rule when you call a function, procedure that has arguments:
    > objects and collections?
    >
    > Thanks,
    > O
    >
    >
    > Chip Pearson wrote:
    > > To help determine the exact location of the error, ensure that
    > > you have your error trapping set to "Break In Class Module". In
    > > VBA, go to the Tools menu, choose Options, then the General tab.
    > > Set the "Error Trapping" setting to "Break In Class Module".
    > >
    > > It is most likely that the actual error is within one of the
    > > classes, and you have your error trapping set to "Break on
    > > unhandled errors". If you don't have the error trapping set to
    > > "Break In Class Module", the code will blow up on the line that
    > > accesses the class, not on the line of code within the class that
    > > is, in fact, causing the error.
    > >
    > >
    > > --
    > > Cordially,
    > > Chip Pearson
    > > Microsoft MVP - Excel
    > > Pearson Software Consulting, LLC
    > > www.cpearson.com
    > >
    > >
    > >
    > >
    > > "bad_boyu" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > Hy,
    > > >
    > > > Let's say I have a dll made in VB6. This dll contains 3 class
    > > > modules(ClassA, ClassB, ClassOper) and one module(MyFunctions).
    > > > In MyFunctions I have a function like this:
    > > > Public Function DoSome(collecFirst as Collection, collecSecond
    > > > as
    > > > Collection, objA as ClassA, objB as ClassB) as Double.
    > > >
    > > > In ClassOper I have the function:
    > > > Public Function DoSomething(collecFirst as Collection,
    > > > collecSecond as
    > > > Collection, objA as ClassA, objB as ClassB) as Double
    > > > If (IsValid) Then
    > > > DoSomething = DoSome(collecFirst, collecSecond,
    > > > objA,
    > > > objB)
    > > > Else
    > > > DoSomething = -10000
    > > > End Function
    > > >
    > > > I have an Excel woorkbook that use this dll. Let's say I have a
    > > > macro
    > > > in Excel called TestDll
    > > > Public Sub TestDll()
    > > > Dim myOper as ClassOper
    > > > Set myOper = New ClassOper
    > > > MsgBox myOper.DoSomething(myCollecFirst, myCollecSecond,
    > > > myObjA,
    > > > myObjB)
    > > > End Sub
    > > > When trying to run TestDll I get the following error: "argument
    > > > not
    > > > optional Error 449"
    > > >
    > > > Can somebody help me with this? (I hope that my example I
    > > > good..)
    > > >
    > > > Thanks and best regards,
    > > > O
    > > >

    >




+ 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