4

I have a simple visual basic window (or 'form'), and at the click of a button on the form, I want my Python script to run. How would I go about this?

3
  • Why did this get down-voted? Just wondering is all. Commented Apr 14, 2014 at 21:03
  • 2
    because some persons thinking themselves funny or smart come and put -1 on a question ! it happened to me on many question, you ask they put you -1 like kids ! They don't understand that there is nothing called a wrong question ... anyway man never mind i will vote you +1 so that you get 0 instead of -1 :) Commented Apr 18, 2014 at 22:23
  • @JustGreat Ok, thanks! ...I'm kinda new to StackOverflow ;) Commented Apr 20, 2014 at 22:16

3 Answers 3

4

You can do something like :

Dim ReturnValue

ReturnValue= Shell("C:\python23\python ""C:\Myscripts\Mypythonscript.py"" ", vbHide)
Sign up to request clarification or add additional context in comments.

Comments

4

Edit to answer this question. Some referenced the used of the command "shell". This is not a good practice, rather, use Process.Start().

Comments

3

If you just want to run it, then double click the button, then once you see the code responsible for your button once you click it, enter this code, but with your specific location and script name;

obj = CreateObject("WScript.Shell")
obj.run("C:\Directory\File.py")

Hope this helps!

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.