VB Functon as Sub

Discussion in 'SolidWorks' started by That70sTick, Jan 9, 2007.

  1. That70sTick

    That70sTick Guest

    Example of Function called as Sub:

    'MsgBox function return "OK" or "cancel" to variable "retLong"
    retLong = MsgBox("OK to proceed", vbOKCancel)

    'MsgBox function called as Sub, with no return variable
    MsgBox "OK to proceed?", vbOKCancel

    Both of these will have the same external behavior, pausing the program
    to get input. Only the first allows you to see what the user selected.
    Long values for vbOK (=1) or vbCancel (=2) are returned to the
    variable "retLong" based on user selection.
     
    That70sTick, Jan 9, 2007
    #1
  2. That70sTick

    Gil Alsberg Guest

    That70sTick,
    Now i understand competely. thanks for putting the time and effort to help
    me!

    cheers,
    Gil
     
    Gil Alsberg, Jan 10, 2007
    #2
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.