Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

傳回 Boolean 值,指出 變數 是否已初始化。

語法

IsEmpty ( 表示 式)

必要 表達 式引數 是包含數值或 字串運算式的 Variant。 不過,由於 IsEmpty 是用來判斷是否初始化個別變數, 表達式 自變數通常是單一變數名稱。

註解

如果變數未初始化或明確設定為 空白,IsEmpty 會傳回 True;否則,它會傳回 False如果表達式包含一個以上的變數,則一律會傳回 False。 IsEmpty 只會針對變體傳回有意義的資訊。

範例

附註: 下列範例示範如何在 Visual Basic for Applications (VBA) 模組中使用此函數。 如需使用 VBA 的詳細資訊,請在 [搜尋] 旁的下拉式清單中選取 [開發人員參考],並在 [搜尋] 方塊中輸入一個或多個字詞。

此範例使用 IsEmpty 函數來判斷變數是否已初始化。

Dim MyVar, MyCheck
MyCheck = IsEmpty(MyVar) ' Returns True.
MyVar = Null ' Assign Null.
MyCheck = IsEmpty(MyVar) ' Returns False.
MyVar = Empty ' Assign Empty.
MyCheck = IsEmpty(MyVar) ' Returns True.

Need more help?

Want more options?

探索訂閱權益、瀏覽訓練課程、瞭解如何保護您的裝置等等。

社群可協助您詢問並回答問題、提供意見反應,以及聆聽來自具有豐富知識的專家意見。

Was this information helpful?

How satisfied are you with the translation quality?
What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×