Skip to content

Commit 9bfcda8

Browse files
Update Usage02.md
1 parent d06928d commit 9bfcda8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/tutorials/Usage02.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
A more practical use of xlpython
1+
A more practical use of ExcelPython
22
---
33

44
The above example gives a light introduction to manipulating a few simple objects through VBA. In practice though, what's needed is a way to get a load of inputs from Excel, pass them to a method defined in a Python script somewhere, get the outputs back from Python and use them VBA or place them in the spreadsheet as required.
@@ -10,10 +10,10 @@ PyModule returns a pointer to a Python module, much like the import statement. I
1010
?Py.Str(Py.Module("datetime"))
1111
<module 'datetime' (built-in)\>
1212

13-
If you want to call functions from a script which you have placed in a non-standard location, you can tell xlpython to add additional search directories before trying to load the module, as follows:
13+
By default the Python instance associated with a workbook runs in that workbook's folder (as determined by `ThisWorkbook.Path`), so if you place a Python script in that folder, you can load it as a module.
1414

15-
?Py.Str(Py.Module("MyScript", Py.AddPath("D:\Scripts")))
16-
<module 'MyScript' from 'D:\Scripts\MyScript.py'\>
15+
?Py.Str(Py.Module("MyScript"))
16+
<module 'MyScript' from 'C:\WorkbookFolder\MyScript.py'\>
1717

1818
Once you have access to the module you want, you can use `Py.Call` to invoke functions contained in the module (note that `Py.Call` actually calls any method of any object, not just module objects). This is done by explicitly passing the ordered and keyword arguments. For example calling
1919

0 commit comments

Comments
 (0)