Picture in Excel issue

Jim Chiang jchiang2 at ford.com
Mon Oct 2 03:33:17 CEST 2006

I'm trying to very simply insert a picture from a file into an excel
spreadsheet. I know how to do this in VBA and it works fine, however when I
try this from python I get an error. Doing a search on this turned up

The code I'm using is:

from win32com.client.dynamic import Dispatch

xl = Dispatch( 'Excel.Application' )





Traceback (most recent call last):

  File "<pyshell#7>", line 1, in <module>


AttributeError: 'function' object has no attribute 'Insert'


I'm not sure why I get this issue since
'ActiveSheet.Pictures.Insert("C:\a.jpg")' works fine from within Excel.
Several internet posts from my searches also suggest to use this method.


I've tried this on both Python 2.1 and 2.5 with the same results.

Any idea what the problem is or how I can insert the picture??





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20061001/ab770037/attachment.html>

More information about the Python-list mailing list