0

我正在尝试在 Arena 中创建一个简单的 sub,它在模拟开始时打开一个 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 文件并确定了名称匹配。谁能帮我?

4

0 回答 0