gpt4 book ai didi

vba - 在 Excel 中使用 VBA 查看我是否有权打开文件

转载 作者:行者123 更新时间:2023-12-04 20:14:34 25 4
gpt4 key购买 nike

我的系统中有一个文件破坏了我的代码。当我尝试通过 VBA 打开文件或仅通过文件系统打开文件时,我收到此错误。 “您无权访问此电子表格。”

我想知道是否有办法在尝试打开文件之前使用 VBA 检查文件权限。

最佳答案

您是否尝试过类似的方法:

On Error Resume Next
'Open that might fail
On Error GoTo 0
If Err.Number > 0 Then
Call MsgBox("Open failed because " & Err.Description, vbOKOnly)
Exit Sub
End If

' If get here, file was opened successfully

关于vba - 在 Excel 中使用 VBA 查看我是否有权打开文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30623898/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com