打开Excel文件时跳过提示

时间:2018-06-12 12:52:50

标签: excel-vba vba excel

我有一个VBA代码循环遍历文件夹,但文件都非常大,所以它们需要很长时间才能打开,并且它们都设置为只读。 我想跳过只读提示以及出现的更新链接提示。我已经尝试过这些代码而没有运气

(1) ActiveWorkbook.ChangeFileAccess Mode:=xlReadOnly
 Set Scebook = Workbooks.Open(xPath & xFile)

(2)Application.ScreenUpdating = False
Set Scebook = Workbooks.Open(xPath & xFile)

(3) Application.DisplayAlerts = False
Set Scebook = Workbooks.Open(xPath & xFile)

(4) Application.EnableEvents = False
Set Scebook = Workbooks.Open(xPath & xFile)

(5)Set Scebook = Workbooks.Open(xPath & xFile,_ 
IgnoreReadOnlyRecommended:=True)

1 个答案:

答案 0 :(得分:0)

在open方法中设置可选的只读和更新链接:

Set Scebook = Workbooks.Open(xPath & xFile,0,1)

MSDN Documentation