VBA - Python

python
vba

#1

I want to start a Python script from VBA with a string argument that contain spaces. Python interpreted a space as a new argument. I want to use this string variable to be used in the Python script. Can anyone help me with this problem?


#2

My guess is that it’s VBA that split the string, not python (that you didn’t actually send an argument containing spaces, you sent multiple arguments instead)

But guessing is all I can do without having a way of reproducing it (I don’t know what you did)


#3

It is correct that Python sees it as multiple arguments. This is because python gets the following command in the DOS environment "python test.py Hello World"
An example of the code in VBA:
Message = "Hello World"
call python test.py Message

As you can see in the DOS environment the VBA string breaks up in multiple parts.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.