Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

My(very)SimpleOverload

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • My(very)SimpleOverload

    A pretty nonsense functionality.. this way of course but may help..

    Code:
    Sub OverloadStr( ByVal sParam As String )
        MsgBox "String: " & sParam
    End Sub 
    
    Sub OverloadLng( ByVal lParam As Long )
        MsgBox "Long: " & Format$( lParam )
    End Sub 
    
    Macro MySimpleOverload( p1 )
    
        MacroTemp v
        Dim v As Variant
        v = p1
        If VariantVT( v ) = %VT_BStr Then
            OverloadStr( Variant$( v ) )
        Else
            OverloadLng( Variant#( v ) )
        End If
    
    End Macro
    Usage:
    Code:
        MySimpleOverload( "hello" )
        MySimpleOverload( 1234 )
    hellobasic
Working...
X