I am writing vbas in excel in windows 10 and everything works just fine. But since we are moving to windows 11, we have to make sure those vbas work as well. We want to run specific python file-s from the given macro.
PythonExe = "Path/to/phyton.exe"
PythonScript = """Path/to/python_script.py"""
objShell.Run "cmd.exe /s /c " & PythonExe & " " & PythonScript, windowStyle, waitOnReturn
We get an error that states: suspicious macros, the windows defender blocked running them. It always happen when the vba reaches the above lines.
But if I run the macro row-by-row it somehow does it job.
I assume this is a Windows 11 specific error, because we have been using this code in the past 6 months on Windows 11.
Any help why does it happen?
We tried to add the file location to the truested location, but it gave the same error. File> Options> Trust Center> Trust Center Settings> Trusted Locations