如何使用 Arena VBA 打开 Excel 文件?

问题描述

我正在尝试在 Arena 中创建一个简单的子程序,它会在模拟开始时打开一个 excel 文件。 这是从 Arena 帮助示例中获取代码

Private Sub ModelLogic_RunBeginSimulation()
Dim m As Model
Set m = ThisDocument.Model
Dim FiletoOpen As String
Dim ArenaDir As String
'Start Excel and get a "handle" to the Excel application,using some variable
'of your own,like XL. For information on Excel's Object Model and how to
'automate Excel you will need to refer to Excel's online help and
'documentation.
Set XL = Getobject("","Excel.Application")
FiletoOpen = "filename.xls"
'Open the file.
XL.Workbooks.Open FiletoOpen
End Sub

但是当我尝试运行它时出现消息错误 1004,它找不到要打开的文件。显然我创建了 Excel 文件并确定名称匹配。有人可以帮我吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)