Excel VBA - 运行时错误 1004(RefreshAll 失败)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12616331/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 17:52:40  来源:igfitidea点击:

Excel VBA - Runtime error 1004 (RefreshAll fails)

excelexcel-vbavba

提问by CustomX

I have created a macro to refresh my workbook (recalc values, refresh links, etc).

我创建了一个宏来刷新我的工作簿(重新计算值、刷新链接等)。

The code to refresh links works fine but when it hits the RefreshAllI get the following error.

刷新链接的代码工作正常,但是当它遇到RefreshAll以下错误时。

ActiveWorkbook.UpdateLink Name:="F:\klanten.xlsm", Type:=xlExcelLinks
ActiveWorkbook.RefreshAll

enter image description here

在此处输入图片说明

All help is appreciated!

感谢所有帮助!

采纳答案by brettdj

Rather than a RefreshAlloption you are looking for a Calculateoption

RefreshAll您正在寻找一个Calculate选项,而不是一个选项

I suggest you use Application.CalculateFullto calculate all formulae

我建议你Application.CalculateFull用来计算所有的公式

This link from Charles Williams on Excel Calculation Methodsmay prove useful

查尔斯·威廉姆斯 (Charles Williams) 关于Excel 计算方法的链接可能证明有用