IsOpen 属性


如果当前 WebFile 对象是打开的,则为 True。只读,Boolean 类型。


本示例使用 IsOpen 属性来检查文件是否打开。

Private Sub CheckForOpenFile()
    Dim myWeb As WebEx
    Dim myFiles As WebFiles
    Dim myFile As WebFile
    Dim myFileToOpen As String
    Dim myMessage As String
    Dim myFileName As String

    Set myWeb = ActiveWeb
    Set myFiles = myWeb.RootFolder.Files

    myFileToOpen = "index.htm"
    myMessage = "This file is open, try again later."

    With myWeb
        For Each myFile In myFiles
            If myFileName = myFileToOpen Then
                If myFile.IsOpen = True Then
                    MsgBox (myMessage)
                    Exit Sub
                    myFile.Open (fpPageViewNormal)
                    Exit Sub
                End If
            End If
    End With
End Sub