dayjournal memo

Total 975 articles!!

VBA #018 - 処理をまとめる (戻り値あり)

Yasunori Kirimoto's avatar

画像



戻り値ありで処理をまとめるメモ。



common.bas


Dim answer As String
Dim result As String

'Function01
answer = Function01("Function01")
result = answer

'Function02
answer = Function02("Function02")
result = result & vbNewLine & answer

'Function03
answer = Function03("Function03")
result = result & vbNewLine & answer

'文字列表示
MsgBox result



Function Function01(txt As String)

    txt = txt & "!"

    '戻り値
    Function01 = txt

End Function

Function Function02(txt As String)

    txt = txt & "!!"

    '戻り値
    Function02 = txt

End Function

Function Function03(txt As String)

    txt = txt & "!!!"

    '戻り値
    Function03 = txt

End Function


画像



book

Q&A