+ Reply to Thread
Results 1 to 4 of 4

Calling Python code from Excel VBA

  1. #1
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Brazil
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    268

    Calling Python code from Excel VBA

    Hi , I´m trying to call a Python Script (.py file) from my Excel VBA code
    I searched on the internet and found that it can be done using Shell function, but it gives me runtime error 5 Invalid procedure call or argument.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Re: Calling Python code from Excel VBA

    Good afternoon trizzo

    24 hours on and no takers, so I'll chuck my offering in - I've not posted sooner as I don't have Python installed on my machine, so can't test it, but this is what I use as a universal file opening tool and it's not let me down yet ...

    Please Login or Register  to view this content.
    HTH

    DominicB

  3. #3
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Calling Python code from Excel VBA

    do you consider using xlwings https://www.xlwings.org?
    If you are pleased with a member's answer then use the Star icon to rate it.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Calling Python code from Excel VBA

    This worked for me, where 'comboboxes.py' is a python file in C:\test.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How do I save data I'm collecting in Python for Excel.
    By tebbens in forum Excel General
    Replies: 6
    Last Post: 05-09-2017, 12:07 PM
  2. [SOLVED] Porting Python code to VB?
    By Rhudi in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-26-2016, 01:17 PM
  3. python in excel
    By idandush in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-05-2015, 04:26 PM
  4. Can you use (or compile?) Python code in Excel
    By mrvp in forum The Water Cooler
    Replies: 7
    Last Post: 06-08-2014, 06:49 AM
  5. call a python script from excel vba
    By sheffieldlad in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-28-2013, 07:11 PM
  6. Python commands in Excel
    By ljoseph in forum Excel General
    Replies: 0
    Last Post: 09-18-2009, 07:02 AM
  7. Excel and Python
    By davidlawrence in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-24-2008, 08:42 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1