VBA Calling program in Python

Asked

Viewed 805 times

-1

Hello, I work for some time developing in VBA. but I’m beginning to learn Python and the following Doubt has arisen ... is it possible to unite these languages ? because I did not find anything in google that helped me. My idea is to develop actions in python and do buttons in vba calling that programming ! I even saw a subject that microsoft was studying migrate the excel language from VBA to Python, or have compatibility with the Two, but I believe that this change has not yet occurred !

1 answer

2

I recommend these two methods

Using the Library Shell method Retval:

dim Retval
executarScript = Shell("<localização do executável python.exe> " & "<localização do script>")

Create a web service by python, running on your machine or remotely:

Dim httpObject As Object
 Set httpObject = CreateObject("MSXML2.XMLHTTP")

 req = "https://localhost:XXXX/webservice/fazer-receber_algo"

 httpObject.Open "GET", req, False
 httpObject.send
 resultado = httpObject.responseText

It has libraries for communication of both, but not worth using for bugs, unnecessarily complex documentation, and are abandoned projects.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.