<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent changes to wiki</title><link href="https://sourceforge.net/p/excelpython/wiki/" rel="alternate"/><link href="https://sourceforge.net/p/excelpython/wiki/feed.atom" rel="self"/><id>https://sourceforge.net/p/excelpython/wiki/</id><updated>2014-07-17T09:41:34.421000Z</updated><subtitle>Recent changes to wiki</subtitle><entry><title>Home modified by Eric Reynolds</title><link href="https://sourceforge.net/p/excelpython/wiki/Home/" rel="alternate"/><published>2014-07-17T09:41:34.421000Z</published><updated>2014-07-17T09:41:34.421000Z</updated><author><name>Eric Reynolds</name><uri>https://sourceforge.net/u/ericreynolds/</uri></author><id>https://sourceforge.net3f4389ca0e69a5280a74d4b20d7d3ef5145d905e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v11
+++ v12
@@ -1 +1 @@
-For up-to-date documentation please visit the ExcelPython GitHub site - https://github.com/ericremoreynolds/excelpython/wiki
+For up-to-date documentation please visit the ExcelPython GitHub site - https://github.com/ericremoreynolds/excelpython
&lt;/pre&gt;
&lt;/div&gt;</summary></entry><entry><title>Home modified by Eric Reynolds</title><link href="https://sourceforge.net/p/excelpython/wiki/Home/" rel="alternate"/><published>2014-06-16T07:42:29.699000Z</published><updated>2014-06-16T07:42:29.699000Z</updated><author><name>Eric Reynolds</name><uri>https://sourceforge.net/u/ericreynolds/</uri></author><id>https://sourceforge.net3fd3e89208eadf374591bf6c7bd708ba544fa49c</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v10
+++ v11
@@ -1 +1 @@
-For up-to-date documentation please visit the ExcelPython GitHub site - https://github.com/ericremoreynolds/excelpython
+For up-to-date documentation please visit the ExcelPython GitHub site - https://github.com/ericremoreynolds/excelpython/wiki
&lt;/pre&gt;
&lt;/div&gt;</summary></entry><entry><title>Home modified by Eric Reynolds</title><link href="https://sourceforge.net/p/excelpython/wiki/Home/" rel="alternate"/><published>2014-06-09T08:09:11.472000Z</published><updated>2014-06-09T08:09:11.472000Z</updated><author><name>Eric Reynolds</name><uri>https://sourceforge.net/u/ericreynolds/</uri></author><id>https://sourceforge.net57c6c7fdadc8d7f8b69adc4832e88ac18109c3c9</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v9
+++ v10
@@ -1,17 +1 @@
-Getting started
-===
-
-
-Installation
----
-
-ExcelPython is now packaged up in an installer which registers the relevant type libraries.
-
-
-Tutorials
----
-
-* [A very simple usage example]
-* [A more practical use of ExcelPython]
-* [Putting it all together]
-* [Lists and SAFEARRAYs]
+For up-to-date documentation please visit the ExcelPython GitHub site - https://github.com/ericremoreynolds/excelpython
&lt;/pre&gt;
&lt;/div&gt;</summary></entry><entry><title>Home modified by Eric Reynolds</title><link href="https://sourceforge.net/p/excelpython/wiki/Home/" rel="alternate"/><published>2014-01-15T10:17:18.337000Z</published><updated>2014-01-15T10:17:18.337000Z</updated><author><name>Eric Reynolds</name><uri>https://sourceforge.net/u/ericreynolds/</uri></author><id>https://sourceforge.net12217f90f041b6bb11803600d0025361f3c80aae</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v8
+++ v9
@@ -8,109 +8,10 @@
 ExcelPython is now packaged up in an installer which registers the relevant type libraries.

-A very simple usage example
+Tutorials
 ---

-First of all add a reference to the ExcelPython type library. To do this, open Excel, go to the VBA window (Alt-F11) and select Tools &gt; References. Scroll down and select ExcelPythonXX where XX is 26 or 27 depending on which version of Python you have installed on your machine (note only Python 2.6 and 2.7 are supported currently). Click OK to get back to VBA.
-
-You can try out ExcelPython from the VBA Immediate Window (Ctrl + G if it's not already visible in the VBA window).
-
-Type the following
-
-    ?PyStr(PyEval("1+2"))
-
-and press return. You should see 
-
-    ?PyStr(PyEval("1+2"))
-    3
-
-You can try evaluating any Python expression, and you'll get the result
-printed in the Immediate Window.
-
-    ?PyStr(PyEval("[1,2,3]+[4,5,6]"))
-    [1, 2, 3, 4, 5, 6]
-
-(As a side note: why is the PyStr function needed? If you try just calling
-
-    ?PyEval("1+2")
-
-you'll get a type mismatch error. This is because the PyEval function
-returns a handle to the Python object itself, and VBA doesn't know how
-to print it to the Immediate Window. PyStr takes a Python object and
-calls the Python str function on it and returns a VBA string, which can
-be printed)
-
-The PyEval function takes as an optional second argument a locals dictionary to be used when evaluating the expression. To build the dictionary, you can use the function PyDict which takes alternating keys and values as arguments.
-
-    ?PyStr(PyEval("x+y", PyDict("x", 3, "y", 4)))
-    7
-    ?PyStr(PyEval("x+y", PyDict("x", "abc", "y", "def")))
-    abcdef
-
-
-A more practical use of ExcelPython
----
-
-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.
-
-The key to doing this are the methods PyModule and PyCall.
-
-PyModule returns a pointer to a Python module, much like the import statement. If no additional arguments are specified, the embedded Python interpreter will look for the requested module in the default search path.
-
-    ?PyStr(PyModule("datetime"))
-    
-
-If you want to call functions from a script which you have placed in a non-standard location, you can tell ExcelPython to add additional search directories before trying to load the module, as follows:
-
-    ?PyStr(PyModule("MyScript", AddPath:="D:\\Scripts"))
-    
-
-Once you have access to the module you want, you can use PyCall to invoke functions contained in the module (note that PyCall 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
-
-    ?PyStr(PyCall(PyModule("datetime"), "date", Args:=PyTuple(2013, 8, 9)))
-    2013-08-09
-
-is equivalent to calling `datetime.date(2013, 8, 9)`, whereas
-
-    ?PyStr(PyCall(PyModule("datetime"), _
-        "timedelta", Args:=PyTuple(3), KwArgs:=PyDict("milliseconds", 500)))
-    3 days, 0:00:00.500000
-
-is like calling `datetime.timedelta(3, milliseconds=500)`.
-
-Putting it all together
----
-
-Let's suppose we have the following script MyScript.py saved in the same folder as the workbook.
-
-    :::python
-    def MyFunction(x, y):
-      return {
-        "sum": x + y,
-        "sorted": sorted([x, y])
-      }
-
-The following VBA code can be used to call this function, taking the input parameters from a worksheet and pasting the outputs back to that sheet.
-
-    Function PyPath()
-        PyPath = ThisWorkbook.Path
-    End Function
-    
-    Sub CallPythonCode()
-        Set res = PyCall( _
-            PyModule("MyScript", AddPath:=PyPath), "MyFunction", _
-            KwArgs:=PyDict( _
-                "x", Sheet1.Range("A1").Value2, _
-                "y", Sheet1.Range("A2").Value2))
-        Sheet1.Range("A3").Value2 = PyVar(PyGetItem(res, "sum"))
-        Sheet1.Range("A4:B4").Value2 = PyVar(PyGetItem(res, "sorted"))
-    End Sub
-
-The function `PyPath` is a utility function which returns our additional module search path. It's set up so that to access Python scripts we just need to place them in the same folder as the workbook. It's worth defining this once in your workbook's VBA project for use wherever necessary.
-
-The calls to `PyModule` and `PyCall` have been explained above. Once the result dictionary is obtained from the function, its elements can be accessed using `PyGetItem`.
-
-Finally, we use `PyVar` to convert the Python objects into variants so that they can be pasted into worksheet ranges.
-
-
-    
+* [A very simple usage example]
+* [A more practical use of ExcelPython]
+* [Putting it all together]
+* [Lists and SAFEARRAYs]
&lt;/pre&gt;
&lt;/div&gt;</summary></entry><entry><title>Putting it all together modified by Eric Reynolds</title><link href="https://sourceforge.net/p/excelpython/wiki/Putting%2520it%2520all%2520together/" rel="alternate"/><published>2014-01-15T09:51:28.303000Z</published><updated>2014-01-15T09:51:28.303000Z</updated><author><name>Eric Reynolds</name><uri>https://sourceforge.net/u/ericreynolds/</uri></author><id>https://sourceforge.net333d5fe75e6aa4426c62e3ec730f3a555a12173b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;h2 id="putting-it-all-together"&gt;Putting it all together&lt;/h2&gt;
&lt;p&gt;Let's suppose we have the following script MyScript.py saved in the same folder as the workbook.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;MyFunction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s"&gt;&amp;quot;sum&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s"&gt;&amp;quot;sorted&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The following VBA code can be used to call this function, taking the input parameters from a worksheet and pasting the outputs back to that sheet.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;Function&lt;/span&gt; &lt;span class="n"&gt;PyPath&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;PyPath&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ThisWorkbook&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Path&lt;/span&gt;
&lt;span class="n"&gt;End&lt;/span&gt; &lt;span class="n"&gt;Function&lt;/span&gt;

&lt;span class="n"&gt;Sub&lt;/span&gt; &lt;span class="n"&gt;CallPythonCode&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;Set&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;PyCall&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;
        &lt;span class="n"&gt;PyModule&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;MyScript&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;AddPath&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="n"&gt;PyPath&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;MyFunction&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;
        &lt;span class="nl"&gt;KwArgs:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;PyDict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;
            &lt;span class="s"&gt;&amp;quot;x&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Sheet1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;A1&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;Value2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;
            &lt;span class="s"&gt;&amp;quot;y&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Sheet1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;A2&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;Value2&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="n"&gt;Sheet1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;A3&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;Value2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;PyVar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PyGetItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;sum&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="n"&gt;Sheet1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;A4:B4&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;Value2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;PyVar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PyGetItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;sorted&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="n"&gt;End&lt;/span&gt; &lt;span class="n"&gt;Sub&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The function &lt;code&gt;PyPath&lt;/code&gt; is a utility function which returns our additional module search path. It's set up so that to access Python scripts we just need to place them in the same folder as the workbook. It's worth defining this once in your workbook's VBA project for use wherever necessary.&lt;/p&gt;
&lt;p&gt;The calls to &lt;code&gt;PyModule&lt;/code&gt; and &lt;code&gt;PyCall&lt;/code&gt; have been explained above. Once the result dictionary is obtained from the function, its elements can be accessed using &lt;code&gt;PyGetItem&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Finally, we use &lt;code&gt;PyVar&lt;/code&gt; to convert the Python objects into variants so that they can be pasted into worksheet ranges.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>A more practical use of ExcelPython modified by Eric Reynolds</title><link href="https://sourceforge.net/p/excelpython/wiki/A%2520more%2520practical%2520use%2520of%2520ExcelPython/" rel="alternate"/><published>2014-01-15T09:50:54.158000Z</published><updated>2014-01-15T09:50:54.158000Z</updated><author><name>Eric Reynolds</name><uri>https://sourceforge.net/u/ericreynolds/</uri></author><id>https://sourceforge.neta3885de24548c733933bfa213327dc0e1db10a08</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;h2 id="a-more-practical-use-of-excelpython"&gt;A more practical use of ExcelPython&lt;/h2&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;The key to doing this are the methods PyModule and PyCall.&lt;/p&gt;
&lt;p&gt;PyModule returns a pointer to a Python module, much like the import statement. If no additional arguments are specified, the embedded Python interpreter will look for the requested module in the default search path.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="n"&gt;PyStr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PyModule&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;datetime&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;module&lt;/span&gt; &lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;built&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;in&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you want to call functions from a script which you have placed in a non-standard location, you can tell ExcelPython to add additional search directories before trying to load the module, as follows:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="n"&gt;PyStr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PyModule&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;MyScript&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;AddPath&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;D:&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s"&gt;Scripts&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;module&lt;/span&gt; &lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;MyScript&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt; &lt;span class="n"&gt;from&lt;/span&gt; &lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;D&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="err"&gt;\\&lt;/span&gt;&lt;span class="n"&gt;Scripts&lt;/span&gt;&lt;span class="err"&gt;\\&lt;/span&gt;&lt;span class="n"&gt;MyScript&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;py&lt;/span&gt;&lt;span class="err"&gt;'\&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Once you have access to the module you want, you can use PyCall to invoke functions contained in the module (note that PyCall 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&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="n"&gt;PyStr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PyCall&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PyModule&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;datetime&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;date&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Args&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="n"&gt;PyTuple&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2013&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;
&lt;span class="mi"&gt;2013&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;08&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;09&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;is equivalent to calling &lt;code&gt;datetime.date(2013, 8, 9)&lt;/code&gt;, whereas&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="n"&gt;PyStr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PyCall&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PyModule&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;datetime&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;
    &lt;span class="s"&gt;&amp;quot;timedelta&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Args&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="n"&gt;PyTuple&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;KwArgs&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="n"&gt;PyDict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;milliseconds&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;
&lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="n"&gt;days&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="mo"&gt;00&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="mf"&gt;00.500000&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;is like calling &lt;code&gt;datetime.timedelta(3, milliseconds=500)&lt;/code&gt;.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>A very simple usage example modified by Eric Reynolds</title><link href="https://sourceforge.net/p/excelpython/wiki/A%2520very%2520simple%2520usage%2520example/" rel="alternate"/><published>2014-01-15T09:49:51.499000Z</published><updated>2014-01-15T09:49:51.499000Z</updated><author><name>Eric Reynolds</name><uri>https://sourceforge.net/u/ericreynolds/</uri></author><id>https://sourceforge.netb8cf2970b9154e51c47ebfd5869c31abfce72cb9</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v2
+++ v3
@@ -0,0 +1,38 @@
+A very simple usage example
+---
+
+First of all add a reference to the ExcelPython type library. To do this, open Excel, go to the VBA window (Alt-F11) and select Tools &gt; References. Scroll down and select ExcelPythonXX where XX is 26 or 27 depending on which version of Python you have installed on your machine (note only Python 2.6 and 2.7 are supported currently). Click OK to get back to VBA.
+
+You can try out ExcelPython from the VBA Immediate Window (Ctrl + G if it's not already visible in the VBA window).
+
+Type the following
+
+    ?PyStr(PyEval("1+2"))
+
+and press return. You should see 
+
+    ?PyStr(PyEval("1+2"))
+    3
+
+You can try evaluating any Python expression, and you'll get the result
+printed in the Immediate Window.
+
+    ?PyStr(PyEval("[1,2,3]+[4,5,6]"))
+    [1, 2, 3, 4, 5, 6]
+
+(As a side note: why is the PyStr function needed? If you try just calling
+
+    ?PyEval("1+2")
+
+you'll get a type mismatch error. This is because the PyEval function
+returns a handle to the Python object itself, and VBA doesn't know how
+to print it to the Immediate Window. PyStr takes a Python object and
+calls the Python str function on it and returns a VBA string, which can
+be printed)
+
+The PyEval function takes as an optional second argument a locals dictionary to be used when evaluating the expression. To build the dictionary, you can use the function PyDict which takes alternating keys and values as arguments.
+
+    ?PyStr(PyEval("x+y", PyDict("x", 3, "y", 4)))
+    7
+    ?PyStr(PyEval("x+y", PyDict("x", "abc", "y", "def")))
+    abcdef
&lt;/pre&gt;
&lt;/div&gt;</summary></entry><entry><title>ffgdgf modified by Eric Reynolds</title><link href="https://sourceforge.net/p/excelpython/wiki/ffgdgf/" rel="alternate"/><published>2014-01-15T09:48:46.173000Z</published><updated>2014-01-15T09:48:46.173000Z</updated><author><name>Eric Reynolds</name><uri>https://sourceforge.net/u/ericreynolds/</uri></author><id>https://sourceforge.net051dcda937df6b1f2ef70ede9f060996c2784c7b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;pre&gt;&lt;/pre&gt;
&lt;/div&gt;</summary></entry><entry><title>A very simple usage example modified by Eric Reynolds</title><link href="https://sourceforge.net/p/excelpython/wiki/A%2520very%2520simple%2520usage%2520example/" rel="alternate"/><published>2014-01-15T09:48:31.019000Z</published><updated>2014-01-15T09:48:31.019000Z</updated><author><name>Eric Reynolds</name><uri>https://sourceforge.net/u/ericreynolds/</uri></author><id>https://sourceforge.nete6d36538128deb3d23c545a0c62adf07f74bd748</id><summary type="html"/></entry><entry><title>Home modified by Eric Reynolds</title><link href="https://sourceforge.net/p/excelpython/wiki/Home/" rel="alternate"/><published>2013-08-09T14:16:13.134000Z</published><updated>2013-08-09T14:16:13.134000Z</updated><author><name>Eric Reynolds</name><uri>https://sourceforge.net/u/ericreynolds/</uri></author><id>https://sourceforge.net7750eb36dc8332b126d038849af6f93946d18999</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v7
+++ v8
@@ -106,9 +106,7 @@
         Sheet1.Range("A4:B4").Value2 = PyVar(PyGetItem(res, "sorted"))
     End Sub

-Let's go through this step-by-step.
-
-The function `PyPath` is a utility function which returns our additional module search path. It's set up so that to access Python scripts we just need to place them in the same folder as the workbook.
+The function `PyPath` is a utility function which returns our additional module search path. It's set up so that to access Python scripts we just need to place them in the same folder as the workbook. It's worth defining this once in your workbook's VBA project for use wherever necessary.

 The calls to `PyModule` and `PyCall` have been explained above. Once the result dictionary is obtained from the function, its elements can be accessed using `PyGetItem`.

&lt;/pre&gt;
&lt;/div&gt;</summary></entry></feed>