Argument Not Optional HELP

Discussion in 'AutoCAD' started by montyzoomer, Jan 12, 2005.

  1. montyzoomer

    montyzoomer Guest

    I want to run the attached function, I was under the impression I could simply call the function from a sub routine but unfortunately I get an error saying 'Argument not optional'

    the code is as follows
    Function OpenAnyMode(strFileName As String) As AcadDocument

    Dim varMode As Variant
    Dim intCnt As Integer
    Dim objDoc As AcadDocument

    intCnt = Application.Documents.Count

    If intCnt > 0 Then
    varMode = ThisDrawing.GetVariable("SDI")

    If varMode Then

    Set objDoc = ThisDrawing.Open(strFileName)

    Else

    Set objDoc = Application.Documents.Open(strFileName)

    End If

    Else

    Set objDoc = Application.Documents.Open(strFileName)

    End If

    Set OpenAnyMode = objDoc


    End Function

    It is probably something basic that I am missing - can any one point me in the right direction

    Thanks

    Ian
     
    montyzoomer, Jan 12, 2005
    #1
  2. montyzoomer

    Murph Guest

    That subject line sounds like my first marriage.

    Murph
     
    Murph, Jan 12, 2005
    #2
  3. montyzoomer,

    In addition to any replies you might receive or already
    received, you may find more information or responses
    by posting future VBA related questions in the following
    discussion group:

    By NNTP discussion group reader at
    news://discussion.autodesk.com/autodesk.autocad.customization.vba

    By HTTP (web-based) interface at
    http://discussion.autodesk.com/forum.jspa?forumID=33


    Murph,

    :)


    --
    Autodesk Discussion Group Facilitator



    simply call the function from a sub routine but unfortunately I get an error
    saying 'Argument not optional'
     
    Jason Piercey, Jan 12, 2005
    #3
  4. montyzoomer

    montyzoomer Guest

    Thanks Murph, by the way most marriages are like that.

    Thanks
     
    montyzoomer, Jan 12, 2005
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.