gpt4 book ai didi

vba - Workbooks.Open 编译错误

转载 作者:行者123 更新时间:2023-12-04 21:59:13 26 4
gpt4 key购买 nike

我正在尝试在 Microsoft Excel VBA 2010 中使用 Workbooks.Open 方法,但我收到一个编译错误,指出它需要“=”。我打错代码了吗?

Workbooks.Open ( _
Filename:= FromBook, _
UpdateLinks:= xlUpdateLinksNever, _
ReadOnly:= False, _
Format:= 5, _
Password:= "", _
WriteResPassword:= "", _
IgnoreReadOnlyRecommended:= "", _
Origin:= "", _
Delimiter:= "", _
Editable:= "", _
Notify:= "", _
Converter:= "", _
AddToMru:= "", _
Local:= "", _
CorruptLoad:= xlNormalLoad)

最佳答案

这种方式期望将值分配给变量 IE:

Dim myWB as Workbook

Set myWB = Workbooks.Open ( _
Filename:= FromBook, _
UpdateLinks:= xlUpdateLinksNever, _
ReadOnly:= False, _
Format:= 5, _
Password:= "", _
WriteResPassword:= "", _
IgnoreReadOnlyRecommended:= "", _
Origin:= "", _
Delimiter:= "", _
Editable:= "", _
Notify:= "", _
Converter:= "", _
AddToMru:= "", _
Local:= "", _
CorruptLoad:= xlNormalLoad)

如果您真的不需要这种方式,您可以调用电话:
Call Workbooks.Open ( _
Filename:= FromBook, _
UpdateLinks:= xlUpdateLinksNever, _
ReadOnly:= False, _
Format:= 5, _
Password:= "", _
WriteResPassword:= "", _
IgnoreReadOnlyRecommended:= "", _
Origin:= "", _
Delimiter:= "", _
Editable:= "", _
Notify:= "", _
Converter:= "", _
AddToMru:= "", _
Local:= "", _
CorruptLoad:= xlNormalLoad)

关于vba - Workbooks.Open 编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38131992/

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