Sub DS2() On Error Resume Next Dim objConnection As Connection Dim objRecordSet As Recordset Dim ws As Worksheet Set objConnection = CreateObject("ADODB.Connection") Dim s(30) s(0) = "System.FileName" s(1) = "System.Address.Country" s(2) = "System.Address.CountryCode" s(3) = "System.Address.Region" s(4) = "System.Address.RegionCode" s(5) = "System.Address.Town" s(6) = "System.ContentId" s(7) = "System.ContentUri" s(8) = "System.Devices.AudioDevice.Microphone.SensitivityInDbfs2" s(9) = "System.Devices.Panel.PanelGroup" s(10) = "System.Devices.Panel.PanelId" s(11) = "System.Supplemental.Album" s(12) = "System.Supplemental.Location" s(13) = "System.Supplemental.Person" s(14) = "System.Supplemental.Tag" s(15) = "System.AppUserModel.VisualElementsManifestHintPath" s(16) = "System.Devices.AudioDevice.Microphone.IsFarField" s(17) = "System.Devices.PhoneLineTransportDevice.Connected" s(18) = "System.Devices.ChallengeAep" s(19) = "System.StorageProviderFileFlags" s(20) = "System.LastSyncWarning" s(21) = "System.Devices.Aep.Bluetooth.LastSeenTime" s(22) = "System.Devices.SchematicName" s(23) = "System.StorageProviderFileHasConflict" Set objRecordSet = CreateObject("ADODB.Recordset") objConnection.Open "Provider=Search.CollatorDSO;Extended Properties='Application=Windows';" For i = 1 To 23 sql1 = "SELECT " sql1 = sql1 & s(0) & "," & s(i) sql1 = sql1 & " FROM SystemIndex " objRecordSet.Open sql1, objConnection Worksheets(1).Select Worksheets.Add Set ws = Worksheets(1) With ws .Cells(1, 1).Value = s(0) .Cells(1, 2).Value = s(i) .Range("A2").CopyFromRecordset objRecordSet .Name = i End With objRecordSet.Close Next Set objRecordSet = Nothing objConnection.Close Set objConnection = Nothing End Sub