Listing Successful Manual Iteration over Settings

Sub PrintOutAllSettingsO

Dim oSettings As Settings Dim oSetting As Setting Dim nIndex As Integer

Set oSettings = New Settings

For nIndex = 1 To oSettings.Count

Set oSetting = oSettings.Item(nIndex) Debug.Print oSetting.Name & " = " & oSetting.Value

Next

Set oSetting = Nothing Set oSettings = Nothing End Sub

This procedure produced the following output based on the Settings worksheet shown in Figure 12.2.

User Name = Steve Hansen

Report 1 Scaling = thousands

Report 1 Current As Of = 10/1/2003

Report 1 View = detail

Report 2 Scaling = normal

Report 2 Current As Of = 9/23/2003

Report 2 View = summary

Department = finance

Version Date = 9/1/2003

Password = TestSetting

Testing = Testing

Report Worksheet = Report

Report Number Format = #,##0_);[Red](#,##0); " - " Report Scaled Format = #,_);[Red](#,); " - "

0 0

Post a comment