简体   繁体   English

Datanitro Python脚本未在workbook_open()中执行

[英]Datanitro python script not executing in workbook_open()

In ThisWorkbook Excel Object I have the following two subroutines: 在ThisWorkbook Excel对象中,我具有以下两个子例程:

Private Sub Workbook_Open()
    MsgBox "Hello World"

    Call call_DN

End Sub

Sub call_DN()
    Application.COMAddIns("DataNitro.DataNitro").Object.RunScript ("test.py")
    MsgBox "called sub"
End Sub

When I open the workbook I see the "Hello World" message box and then the "called sub" message box but the python script does not execute. 当我打开工作簿时,我看到“ Hello World”消息框,然后看到“被叫子”消息框,但是python脚本没有执行。

However, when I then manually run Workbook_Open() the python script does execute properly. 但是,当我随后手动运行Workbook_Open()时,python脚本确实可以正确执行。

Why is the python script not executing upon application startup? 为什么在应用程序启动时python脚本不执行?

No error messages are being thrown - it seems that the .runscript command is just being ignored. 没有抛出任何错误消息-似乎只是忽略了.runscript命令。

DataNitro has an autostart option for calling a script on workbook start. DataNitro有一个自动启动选项,用于在工作簿启动时调用脚本。 Please use that rather than VBA's workbook open hook. 请使用而不是VBA的工作簿打开钩。

(The workbook open hook should work in theory, but it looks like it doesn't.) (工作簿的“打开钩子”理论上应该起作用,但看起来似乎不起作用。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM