| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Python With VBA ! Run python via VBA
New features, with many changes from 5.x
Lower Version is tested privately; some versions are publicly released, but they are pre-release. They're outdated, unsecure and unstable, so please use only versions 5.2 or above.
Introduce basic uses of PyWimVBA
Sub MySub()
StartPyServer ' Start the server
' Code here
EndPyServer ' Stop the server
End Sub
FACT: You can hide the CMD of PyWimVBA by set silent=true (Read the documention below)
Sub MySub()
'Do a equation in python and export show it with MsgBox
Dim Output as String
StartPyServer ' Start the server
RunPy("myvariable = 8 + 5")
Output = RunPy("print(myvariable)") 'You can extract python value by using "print"
MsgBox Output
EndPyServer ' Stop the server
End Sub
StartPyServer(Optional: pythonPath = "python",Optional useCustomPyServer: False,Optional : silent=false) : Starts PyServer (PyServer supports only single server) silent=true will hide command prompt of PyServer. Set useCustomPyServer to path of your PyServer (can use in offline or a older pyserver)
EndPyServer(Optional deletePyServer: True) - A server doesn't close automatically with VBA, so you need to close it before end VBA code . Use deletePyServer=False to keep your PyServer to reuse in StartPyServer (Not recommend)
CheckPyServer() - Check a or any server is running.
PathPyServer() - Get PyServer path
ClearPyServer() - Because PyServer support only one server, you can use this function to clear cached data like value,etc...
RunPy(code) - Simply run a code of python, split new line with ;; and indentation are space,tab or tab smart syntax: !tab~
LoadPy(file) - Load a python file and convert it to PyWimVBA Syntax
examplefile.py
import time time.sleep(5)
RunPyOld(code,[pythonPath = "python"] , [newengine = False], [ keepFileData = False] , [UseDebug = False])
RunPyOld is "run" function from older version. I suggest you don't use it because it's outdated and buggy
| Back | FazBrowse Home | New Git URL |