<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-2022-jp">
<META content="MSHTML 6.00.2800.1458" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial>Hello,&nbsp;My name is Jiangyu, a Chinese man<FONT 
face=Arial></FONT>.&nbsp;You can call me Joe.</FONT></DIV>
<DIV><FONT face=Arial>I learn Python&nbsp;for only one year.&nbsp; I think it's 
a simple tools in my job some time.</FONT></DIV>
<DIV><FONT face=Arial>But in my country, Python is a new tools for many people. 
So If i have some </FONT></DIV>
<DIV><FONT face=Arial>problems on it, I found it's difficult to look for the 
answers。So I add the this mail list.</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>Now, I have a question about use win32com moudle for 
MS-Excel.</FONT></DIV>
<DIV><FONT face=Arial>Question: I want to insert a file into a Excel 
sheet.&nbsp;</FONT><FONT face=Arial>&nbsp;But a exception occured in my 
code.</FONT></DIV>
<DIV><FONT 
face=Arial>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
Using VBA, I insert a file&nbsp;OK. And the processing in Python is equivalent 
in VBA.</FONT></DIV>
<DIV><FONT face=Arial></FONT><FONT face=Arial></FONT><FONT 
face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>My environment: </FONT><FONT face=Arial>Python2.2.3 + 
win32com + Win2000 Server + Excel(Office XP)</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>My Python code:</FONT></DIV>
<DIV><FONT face=Arial>&gt;&gt;&gt; from win32com.client import 
Dispatch<BR>&gt;&gt;&gt; excel = Dispatch("Excel.Application")<BR>&gt;&gt;&gt; 
excel.Visible = 1<BR>&gt;&gt;&gt; excel.WorkBooks.Add()<BR>&gt;&gt;&gt; cursheet 
= excel.ActiveWorkBook.ActiveSheet<BR>&gt;&gt;&gt; oleobjs = 
cursheet.OLEObjects()<BR>&gt;&gt;&gt; oleobjs.Add(Filename = 
r"c:\temp.txt")</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>My VBA code:</FONT></DIV>
<DIV><FONT face=Arial>ActiveWorkbook.ActiveSheet.OLEObjects.Add 
Filename:="c:\temp.txt", Link:=False, DisplayAsIcon:=False</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>So, If you know how to do it. please answer me. 
Thanks!</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>joe</FONT></DIV>
<DIV><FONT face=Arial>2004/8/13</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV></BODY></HTML>