Patrick,
I was able to get this to work per the instructions in your link. You
might make sure you have the ScriptControl installed properly.
Bill
-------------------------------------------------------
Attribute VB_Name = "Module1"
Global sc As New MSScriptControl.ScriptControl
Sub Main()
End Sub
Private Sub Workbook_Open()
Application.WindowState = xlMaximized
sc.Language = "python"
sc.ExecuteStatement ("import os")
os_getcwd = sc.Eval("os.getcwd()")
resp = MsgBox(os_getcwd, vbInformation)
End Sub
------------------------------------------------------
--------------- William Brown --------------
----- Boeing Networked Systems Technology -----
Blvu:425.373.2738
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: Friday, November 07, 2008 12:00 PM
> To: [email protected]
> Subject: ActivePython Digest, Vol 15, Issue 2
>
> Send ActivePython mailing list submissions to
> [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://listserv.ActiveState.com/mailman/listinfo/activepython
> or, via email, send a message with subject or body 'help' to
> [EMAIL PROTECTED]
>
> You can reach the person managing the list at
> [EMAIL PROTECTED]
>
> When replying, please edit your Subject line so it is more
> specific than "Re: Contents of ActivePython digest..."
>
>
> Today's Topics:
>
> 1. Python from Excel (Bruce Peterson)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 06 Nov 2008 15:14:19 -0800
> From: Bruce Peterson <[EMAIL PROTECTED]>
> Subject: Python from Excel
> To: [email protected]
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="us-ascii"
>
> 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-e
> xcel.html)
> >
> >
> >Do you have any idea how I could enable the python langage in a
> >WindowsXP environment for Excel/VBA?
> >
> >
> >Best regards,
> >Patrick
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://listserv.ActiveState.com/pipermail/activepython/attachm
> ents/20081106/20f96580/attachment-0001.html
>
> ------------------------------
>
> _______________________________________________
> ActivePython mailing list
> [email protected]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
>
> End of ActivePython Digest, Vol 15, Issue 2
> *******************************************
>
_______________________________________________
ActivePython mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython