The easiest way to do this is to covert your python code to be a COM server -- exposing the attributes and methods you want to call from Excel. Then link the COM object to Excel using VBA.
see Hammon & Robinson Python Programming on Win32.

Bruce

At 12:00 PM 11/6/2008, you wrote:

Hi,

I would like to resuse a Python script in Excel2003 environment,
so I try to develop a vba function to call this Python script function.

I found the following example but unfortunately the 'python' language is not
recognize in my excel environment.
Global sc As New MSScriptControl.ScriptControl

Public Function os_getcwd()
sc.Language = "python"
sc.ExecuteStatement ("import os")
os_getcwd = sc.Eval("os.getcwd()")
End Function

With this you can set your Excel formula to =os_getcwd()
(http://www.velocityreviews.com/forums/t319222-re-python-in-excel.html)


Do you have any idea how I could enable the python langage in a WindowsXP environment for Excel/VBA?


Best regards,
Patrick
_______________________________________________
ActivePython mailing list
ActivePython@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython

Reply via email to