Skip to content

Instantly share code, notes, and snippets.

@ron623
Last active August 2, 2018 06:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ron623/e86beab62a450f2087e2b15775d8864a to your computer and use it in GitHub Desktop.
Save ron623/e86beab62a450f2087e2b15775d8864a to your computer and use it in GitHub Desktop.
' ★★★ 値渡しの例 ★★★
Sub Sample_Val()
Dim str As String
str = "もとの文字です(*`▽´*)"
' 値渡しで関数を呼び出す
Call CallByVal(str)
' 上記の関数内で処理した文字列をメッセージボックスにて表示
MsgBox str
End Sub
' ★★★ 値渡しの関数 ★★★
Sub CallByVal(ByVal msg As String)
'受け取った文字列msgを"値を変えました!"に変更
msg = "値を変えました!"
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment