Last active
August 2, 2018 06:40
-
-
Save ron623/90308d3f01f411e0fb723156d82a8b75 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' ★★★ 値渡しの例 その2★★★ | |
Sub Sample_Val_2() | |
Dim str As String | |
str = "もとの文字です(*`▽´*)" | |
' 値渡しで関数を呼び出す | |
str = CallByVal_2(str) | |
' 上記の関数内で処理した文字列をメッセージボックスにて表示 | |
MsgBox str | |
End Sub | |
' ★★★ 値渡しの関数 その2 ★★★ | |
Function CallByVal_2(ByVal msg As String) | |
'受け取った文字列msgを"値を変えました!"に変更 | |
msg = "値を変えました!" | |
' 値渡しの場合でも変更した文字列を戻り値として返せば、変更された文字列がメッセージボックスに表示される | |
CallByVal_2 = msg | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment