0

Please help me make this code works. I want to open an external EXE file using Powerpoint VBA.

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

There are no compiler errors, but when i execute the macro, it does nothing ... I have another alternatives to this code? please help me, thanks!

2
  • What are you trying to do with the file? The code that you have listed opens C:\test.txt as a TextStream, it just does nothing with the stream. Commented Sep 23, 2012 at 13:24
  • ohh ... sorry ... i want to execute an external exe. file ... (like shell comand) ... but i don't know how to do it ... thanks Commented Sep 23, 2012 at 14:48

1 Answer 1

4

If you just want to start the program, try using

Sub open_test()
    Dim sFullPathToExecutable as String
    sFullPathToExecutable = "C:\test.exe"
    Shell sFullPathToExecutable 
End Sub
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.