Results 1 to 3 of 3

Thread: Optional "$?%&*)("/$!!!" :-(

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Location
    St-Élie d'Orford, Quebec, Canada
    Posts
    133
    grrrr !


    How do I test if an optional parameter as been passed to a function if the parameter is an Object ?

    I know I can use IsEmpty for Variables, but objects ???

    Thanks


  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    Instead of defining the Optional Parameter as Object, use Variant then you can use the IsMissing command, i.e.
    Code:
    Sub SomeSub(ByVal sString As String, Optional oObject As Variant)
        If IsMissing(oObject) Then MsgBox "No Object Passed"
    End Sub
    
    Private Sub Command1_Click()
        Call SomeSub("Anything")
    End Sub

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Location
    St-Élie d'Orford, Quebec, Canada
    Posts
    133
    Ah that's what I wanted ISMISSING !!!

    The only thing is that I pass a control ( progrss bar ) to my function (it's a class thing, don't bother with that).

    So I'll try IsMissing with controls to see if it works...
    Thanks

Posting Permissions

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



Click Here to Expand Forum to Full Width