Which way is best to execute a Python script in Excel?

Emile van Sebille emile at fenx.com
Fri Jul 6 09:28:36 EDT 2012


On 7/6/2012 1:31 AM Maurizio Spadaccino said...

> Could you provide me a more detailed 'how-to' tutorial on implementing a VBA macro that calls a script or a function from python, or tell me where on the web I can find it? The OReilly chapter seems a bit hard for me at this stage?

I'm not going to write a how-to, but the relevant bits from the VBA code 
look like this:

Set fpiUtils = CreateObject("fenxDCom.Util")
response = fpiUtils.FirstPartInsp(nomDiam, numFlutes, nomOAL, nomLOC)

> I dont know, for example, where i should tell the macro where to locate the script...

Registering the com server does that for you (the __name__ == __main__ 
part of the python script)

Again, get one of the examples working and move out from there.

Emile






More information about the Python-list mailing list