0

非常に単純な空の文字列を表示しようとしていますが、整数の空の数値を表示する方法はありますか? 私は以下の例を持っています。

Sub()

Dim s As String
Dim Number As Integer

'using a space in double quote
s = " "

'this will display an empty string, well not really empty but the space will make it empty
msgbox(s)

したがって、基本的に同じ整数を実行しようとしていますが、msgboxを使用すると何も表示されません。

4

2 に答える 2

1

整数をまったく設定しない場合、MsgBox を呼び出すと 0 が割り当てられ、0 が表示されます。何も表示されないようにする唯一の方法は、if ステートメントまたは関数を使用することです。

次のようになります。

Private Sub Run()
    Dim number As Integer
    Message(number)
End Sub

Private Sub Message(ByVal input As Integer)
    If input = 0 Then
        MsgBox("")
    Else
        MsgBox(input)
    End If
End Sub
于 2013-08-06T17:55:17.127 に答える