473,378 Members | 1,446 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Run a Python script via Excel/VBA

Hi everyone-I've been trying to find a solution to this problem for ages. I have some python scripts that need to be updated regularly and would like to be able to use a macro to accomplish this. Right now I double click the files and they execute via Shell

Expand|Select|Wrap|Line Numbers
  1. Sub RunPyScript()
  2.  
  3. Dim Ret_Val As Variant
  4. Dim command As String
  5.  
  6. command = Chr(34) & "C:\Users\Jon Doe\python.exe" & Chr(34) & " " & Chr(34) & "C:\Users\Jon Doe\" & "\Roto.py" & Chr(34)
  7. Ret_Val = Shell(command, vbNormalFocus)
  8.  
  9. End Sub


When I attempt to run the above macro, it looks as though it will run the same as when I double click, but Shell exits before the script is executed. If anyone has any ideas on how I can get Shell to remain open until the script is finished, I would greatly appreciate it.
May 19 '18 #1
0 2997

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Mark Buch | last post by:
Hi, i' ve got a little Python script fpr a database export. Now i want to start this program from MS Excel. Do you know if its possible to execute Python Script in a MS Office Product? Thank...
2
by: Kevin T. Ryan | last post by:
Hi Group - I have written a "semi-program" in MS Excel related to running a football pool. I've updated it over the past two years or so, to the point where it is getting pretty advanced. ...
3
by: ian castleden | last post by:
From time to time I see requests for some sort of python MS Excel interface/software. I have written just such software 100% python (works with Jython too! at least it did a year ago). It was...
2
by: Kenneth McDonald | last post by:
I'm not trying to persuade my company to offer Python as a scripting language for their product, but I am trying to give them examples of things that Python can do easily that cannot be done easily...
6
by: tatamata | last post by:
Hello. How can I run some Python script within C# program? Thanks, Zlatko
4
by: michael.pearmain | last post by:
Hi Experts, Looking for a very quick bit on of advice on how to make some python code run. I'm a newbie to both VBA and Python, so i apologise if this is very easy but i'm about to tear my hair...
7
by: hlubenow | last post by:
Hi, recently there was a thread about hiding the python-script from the user. The OP could use http://freshmeat.net/projects/pyobfuscate/ H.
1
by: michael.buonomo | last post by:
We have been using the Google recommended python script for about a year. We recently realized that the script was not crawling our sites url's, but just our folders which reside on the server. The...
13
by: Alligatorr | last post by:
First, I'm completely new to using python, but willing to learn. I have very little programming skills, but again, I'm willing to learn. Second, I have a script (given to me) that receives data...
4
by: Quill_Patricia | last post by:
I have a Python script which is used to load data into a database. Up to now this script has been run by customers from the Windows command prompt using "python edg_loader.pyc". Any error messages...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.