返回列表 上一主題 發帖

[發問] 違反共用原則

非常感謝singo1232001大大的解惑
非常感謝goner大大的解惑

將語法改成這樣就沒有出現"違反共用原則"的錯誤訊息了
Function IsFileOpen(filePath As String) As Boolean
    Dim fso As Object
    Dim file As Object
   
    Set fso = CreateObject("Scripting.FileSystemObject")
    On Error Resume Next
    Set file = fso.OpenTextFile(filePath, 1)
    If Err.Number = 0 Then
        IsFileOpen = False
        file.Close
    Else
        IsFileOpen = True
    End If
    On Error GoTo 0
    Set file = Nothing
    Set fso = Nothing
End Function
======================================
Private Sub Workbook_Open()
Application.OnTime TimeValue("17:00:00"), "full_calc"
End Sub

TOP

        靜思自在 : 自己害自己,莫過於亂發脾氣。
返回列表 上一主題