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.

附註: 如果 Microsoft Jet Expression Service 在沙箱模式中執行,會停用本主題中所述的函數、方法、物件或屬性,以免評估可能不安全的表達式。 如需沙盒模式的詳細資訊,請在 [說明] 中搜尋「沙盒模式」。

傳回金鑰設定及其個別值的清單, (原本是從 Windows 登錄中的應用程式專案或 Macintosh 上的 (專案所建立的 SaveSetting) ,) 應用程式初始化檔案中的資訊。

語法

GetAllSettings ( appname , section )

GetAllSettings 函數語法具有下列自變數:

引數

描述

appname

必要。 包含要求按鍵設定之應用程式或 專案 名稱的字串表達式。 在 Macintosh 上,這是 [系統] 資料夾中 [喜好設定] 資料夾中初始化檔案的檔名。

章節

必要。 包含要求按鍵設定之節名稱的字串e xpressionGetAllSettings 會 傳回 Variant,其內容為二維 陣列 字串,其中包含指定區段中的所有按鍵設定及其對應值。


註解

如果應用程式名稱區段不存在,GetAllSettings 會傳回未初始化的 Variant

範例

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

此範例首先使用 SaveSetting 語句,在指定為 appname 的應用程式的 Windows 登錄中輸入專案,然後使用 GetAllSettings 函數來顯示設定。 請注意,無法使用 GetAllSettings 擷取應用程式名稱和名稱。 最後, DeleteSetting 語 句會移除應用程式的專案。

' Variant to hold 2-dimensional array returned by GetAllSettings
' Integer to hold counter.
Dim MySettings As Variant, intSettings As Integer
' Place some settings in the registry.
SaveSetting appname := "MyApp", section := "Startup", _
key := "Top", setting := 75
SaveSetting "MyApp","Startup", "Left", 50
' Retrieve the settings.
MySettings = GetAllSettings(appname := "MyApp", section := "Startup")
For intSettings = LBound(MySettings, 1) To UBound(MySettings, 1)
Debug.Print MySettings(intSettings, 0), MySettings(intSettings, 1)
Next intSettings
DeleteSetting "MyApp", "Startup"

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!

×