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.

傳回包含 陣列的 aV 要點。

語法

arglist ( 列)

必要的 arglist引數 是指派給 Variant 內陣列元素的逗號分隔值清單。 如果沒有指定自變數,則會建立零長度的陣列。

註解

用來參照陣列元素的表示法包含 變數 名稱,後面接著含有指出所需元素之索引編號的括號。 在下列範例中,第一個 陳述式 會建立一個名為 AVariant 的變數。 第二個語句會將陣列指派給變數 A。 最後一個語句會將第二個數位元素中包含的值指派給另一個變數。

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

Dim A As Variant
A = Array(10,20,30)
B = A(2)

使用陣 語語所指定的下限所決定, 除非陣列符合類型文件庫的名稱,例如 VBA (。陣列) 。 如果符合類型庫名稱的 資格,陣 列不受 OptionBase影響。

附註: 未宣告為陣列的 Variant 仍可包含數位。 Variant 變數可以包含任何類型的數位,但固定長度字串和使用者定義類型除外。 雖然包含數位的 Variant 在概念上與 元素類型為 Variant 的陣列不同,但陣列元素的存取方式相同。

範例

此範例使用 Array 函數傳回包含數位的 Variant

Dim MyWeek, MyDay
MyWeek = Array("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")
' Return values assume lower bound set to 1 (using Option Base
' statement).
MyDay = MyWeek(2) ' MyDay contains "Tue".
MyDay = MyWeek(4) ' MyDay contains "Thu".

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!

×