none
call macro RRS feed

Answers

  • Strictly speaking, a macro is a procedure (sub) without arguments, but yes, it is possible to call one procedure from another, either by simply using its name or by using the keyword Call.

    For example:

    Sub Proc1()
        MsgBox "Hello World"
    End Sub

    Sub Proc2(MyText As String)
        MsgBox MyText
    End Sub

    Sub Proc3()
        Proc1
    End Sub

    Sub Proc4()
        Call Proc1
    End Sub

    Sub Proc5()
        Proc2 "To be or not to be"
    End Sub

    Sub Proc6()
        Call Proc2("To be or not to be")
    End Sub

    Note the absence of parentheses when calling Proc2 without the keyword Call


    Regards, Hans Vogelaar
    Thursday, May 5, 2011 5:50 AM

All replies

  • Strictly speaking, a macro is a procedure (sub) without arguments, but yes, it is possible to call one procedure from another, either by simply using its name or by using the keyword Call.

    For example:

    Sub Proc1()
        MsgBox "Hello World"
    End Sub

    Sub Proc2(MyText As String)
        MsgBox MyText
    End Sub

    Sub Proc3()
        Proc1
    End Sub

    Sub Proc4()
        Call Proc1
    End Sub

    Sub Proc5()
        Proc2 "To be or not to be"
    End Sub

    Sub Proc6()
        Call Proc2("To be or not to be")
    End Sub

    Note the absence of parentheses when calling Proc2 without the keyword Call


    Regards, Hans Vogelaar
    Thursday, May 5, 2011 5:50 AM
  • Thank you Hans
    Thursday, May 5, 2011 12:34 PM