Office VBA教程:RefreshScopes方法

刷新当前可用 ScopeFolder对象的列表。

expression.RefreshScopes

expression   必需。该表达式返回“应用于”列表中的对象之一。

VBA示例

本示例显示“我的电脑”范围内 C:\ 驱动器上所有当前可用的 ScopeFolder对象。


Sub TestRefreshScopesMethod()
' Displays what happens before and after the RefreshScopes
' method is called when a new folder is added to the list
' of scope folders.
    ' List before the folder is created.
    Call ListFolderNames
    ' Create a new folder on the C:\ drive in My Computer.
    ' An error will occur if this folder already exists.
    MkDir Path:="C:\Delete_After_Using"
    ' List after the folder is created.
    Call ListFolderNames
    ' Refresh the list of folders.
    Application.FileSearch.RefreshScopes
    ' The newly-created folder now appears in the list.
    Call ListFolderNames
End Sub
Sub ListFolderNames()
    Dim strResults As String
    ' Loop through all the folder names on the C:\ drive
    ' in My Computer and report the results.
    ' .SearchScopes.Item(1) = "My Computer"
    ' .ScopeFolders.Item(2) = "C:\"
    With Application.FileSearch.SearchScopes.Item(1). _
        ScopeFolder.ScopeFolders.Item(2)
            For i = 1 To .ScopeFolders.Count
            strResults = strResults & .ScopeFolders. _
                Item(i).Name & vbCrLf
        Next i
            MsgBox "Folder Names on C:\...." & vbCrLf & strResults
    End With
End Sub

上页:Office VBA教程:RefreshProject方法 下页:Office VBA教程:ReleaseFocus方法

Office VBA教程:RefreshScopes方法

Office VBA教程:ReleaseFocus方法 Office VBA教程:Remove方法
Office VBA教程:RemoveItem方法 Office VBA教程:Reset方法
Office VBA教程:ResetFileList方法 Office VBA教程:ResetTips方法
Office VBA教程:SaveCopyAs方法 Office VBA教程:SetAvoidRectangle方法
Office VBA教程:SetFocus方法 Office VBA教程:SetSortOrder方法
Office VBA教程:Show方法 Office VBA教程:ShowPopup方法
Office VBA教程:StartWizard方法 Office VBA教程:Update方法
Office VBA教程:新增方法 Office VBA教程:AnswerWizard对象
Office VBA教程:AnswerWizardFiles集合对象 Office VBA教程:Assistant对象
Office VBA教程:Balloon对象 Office VBA教程:BalloonCheckBox对象
版权所有 © 中山市飞娥软件工作室 证书:粤ICP备09170368号