Page 314 - Microsoft Office Excel 2003 Programming Inside Out
P. 314

Microsoft Office Excel 2003 Programming Inside Out

                             There are four SearchIn constants available. Table 13-4 lists the constants available.
                             Table 13-4.  List of msoSearchIn Properties and Their Values
                             msoSearchIn Constants                     Value

                             msoSearchInMyComputer                     0
             Chapter 13
                             msoSearchInOutlook                        1
                             msoSearchInMyNetworkPlaces                2
                             msoSearchInCustom                         3

                             The ScopeFolder property is available for each SearchScope object and references a ScopeFolder
                             object. The ScopeFolder represents the top of the structure in the ScopeFolders collection that
                             contains more ScopeFolder objects. The following example displays the Name and Path prop­
                             erties of the ScopeFolders under the top-level ScopeFolder of each structure:

                             Sub ListScopeFolderObjects()
                                 Dim SS As SearchScope
                                 Dim SF As ScopeFolder
                                 Dim strMessage As String

                                 Application.FileSearch.RefreshScopes
                                 For Each SS In Application.FileSearch.SearchScopes
                                    Select Case SS.Type
                                    Case msoSearchInMyComputer
                                        strMessage = SS.ScopeFolder.Name & vbCr
                                        For Each SF In SS.ScopeFolder.ScopeFolders
                                            strMessage = strMessage & SF.Name & vbTab & vbTab
                                            strMessage = strMessage & “Path = “ & SF.Path & vbCr
                                        Next SF

                                    Case msoSearchInMyNetworkPlaces
                                        strMessage = strMessage & vbCr & SS.ScopeFolder.Name & vbCr
                                        For Each SF In SS.ScopeFolder.ScopeFolders
                                            strMessage = strMessage & SF.Name & vbTab
                                            strMessage = strMessage & “Path = “ & SF.Path & vbCr
                                        Next SF

                                    Case msoSearchInOutlook
                                        strMessage = strMessage & vbCr & SS.ScopeFolder.Name & vbCr
                                        For Each SF In SS.ScopeFolder.ScopeFolders
                                            strMessage = strMessage & SF.Name & vbTab & vbTab
                                            strMessage = strMessage & “Path = “ & SF.Path & vbCr
                                        Next SF
                                    Case Else
                                        strMessage = strMessage & vbCr & “Unknown SearchScope object"




                288
             Part 4:  Advanced VBA
   309   310   311   312   313   314   315   316   317   318   319