【问题标题】:Open an external EXE. file using VBA Powerpoint打开外部 EXE。使用 VBA PowerPoint 文件
【发布时间】:2012-09-15 04:21:02
【问题描述】:

请帮助我使此代码有效。我想使用 Powerpoint VBA 打开一个外部 EXE 文件。

Sub open_test()
Dim FileName, FSO, MyFile
FileName = "C:\test.exe"
Set FSO = CreateObject("Scripting.FileSystemObject")
Set MyFile = FSO.OpenTextFile(FileName, 1)
End Sub

没有编译器错误,但是当我执行宏时,它什么也不做……我还有其他替代代码吗?请帮助我,谢谢

【问题讨论】:

  • 你想用这个文件做什么?您列出的代码将 C:\test.txt 作为TextStream 打开,它对流没有任何作用。
  • 哦……抱歉……我想执行一个外部 exe。文件...(如shell命令)...但我不知道该怎么做...谢谢

标签: vba powerpoint


【解决方案1】:

如果你只是想启动程序,尝试使用

Sub open_test()
    Dim sFullPathToExecutable as String
    sFullPathToExecutable = "C:\test.exe"
    Shell sFullPathToExecutable 
End Sub

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-07-26
    • 2016-07-18
    • 2015-07-20
    • 2020-11-04
    • 1970-01-01
    • 2015-02-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多