【问题标题】:Calling an executable in VBA using command prompt with dynamic file path naming使用带有动态文件路径命名的命令提示符在 VBA 中调用可执行文件
【发布时间】:2014-11-20 21:45:22
【问题描述】:

我目前有一个调用 python 可执行文件的宏。但是,当我运行宏时,它似乎没有运行。我知道这不是可执行文件的问题,因为当我双击它时它运行良好。我也不认为文件路径有问题。

还有什么其他可能的问题。

过去 8 小时我一直在做这件事。

相关代码:

folderPath = Application.ActiveWorkbook.Path

Dim stAppName As String

stAppName = folderPath & "\dist\MCM_MAT2.exe"
Call Shell(stAppName, 1)

【问题讨论】:

  • 能否贴出相关代码?
  • 宏子中有什么?
  • folderPath = Application.ActiveWorkbook.Path Dim stAppName As String stAppName = folderPath & "\dist\MCM_MAT2.exe" 调用 Shell(stAppName, 1)

标签: python vba shell executable


【解决方案1】:

听起来你的工作目录需要在调用 shell 之前设置。

' Go to the desired startup directory. 
ChDir folderPath

【讨论】:

    猜你喜欢
    • 2012-10-12
    • 2022-12-06
    • 2014-06-02
    • 2021-08-14
    • 1970-01-01
    • 2013-07-31
    • 1970-01-01
    • 2013-09-05
    • 2020-01-12
    相关资源
    最近更新 更多