Results 1 to 2 of 2

Thread: argument not optional

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    2

    Post

    i have a module with FindWindow
    i'm trying to Call it with command_click1
    i get the message argument not optional
    what do i do?
    sorry, i'm like, really really really new

  2. #2
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    461

    Post

    We were all there at one point in time ;-)

    "Argument not optional" means that either a Function or a Subroutine was called that needed you to pass it some variables but didn't.

    Here is an example.

    Code:
    Public Sub TestMe(sName as String)
       msgbox sName
    End Sub
    
    Sub Main
       Call TestMe
    End Sub
    This would give you an "Argument not optional" because the definition of "TestMe" says that it has one parameter called sName and when you CALLED TestMe you didn't pass it anything. To make it work you would need to do this

    Code:
    Public Sub TestMe(sName as String)
       msgbox sName
    End Sub
    
    Sub Main
       Call TestMe "Fred"
    End Sub
    Now it works because the number of parameters the definition of TestMe asks for is the same as you gave it when you called it.

    See how you go

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