- 帖子
- 122
- 主題
- 26
- 精華
- 0
- 積分
- 148
- 點名
- 0
- 作業系統
- windos10
- 軟體版本
- office2016
- 閱讀權限
- 20
- 註冊時間
- 2021-7-8
- 最後登錄
- 2023-8-28
|
非常感謝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 |
|