<br><font size=2 face="sans-serif">This worked for me.....the first function
is called to create the copy, the second to format and rename it.</font>
<br>
<br>
<br><font size=2 face="sans-serif">def create_graph (filename,graph): </font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; #instatiate the Excel
object</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; xl = win32com.client.Dispatch(&quot;Excel.Application&quot;)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; #Open the workbook</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; wb = xl.Workbooks.Open
(filename)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; sh = wb.Sheets(&quot;charttemp&quot;)#Select
the first worksheet in the workbook</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; try:</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; print graph[6]</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; wb.Sheets(&quot;charttemp&quot;).Copy(None,
After=wb.Sheets(wb.Sheets.Count))</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; #Rename
the new chart and put this value in a return value for subsequent reference</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; wb.Sheets(wb.Sheets.Count).Name
= graph[6]</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; xl.ActiveWorkbook.Close(SaveChanges=1)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; except:</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; xl.ActiveWorkbook.Close(SaveChanges=1)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; #Quit Excel</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; xl.Quit</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; del xl</font>
<br>
<br>
<br>
<br><font size=2 face="sans-serif">def format_chart(filename, graph):</font>
<br>
<br><font size=2 face="sans-serif">#instatiate the Excel object</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; xl = win32com.client.Dispatch(&quot;Excel.Application&quot;)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; #Open the workbook</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; wb = xl.Workbooks.Open
(filename)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; try:</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; wb.Charts(graph[6]).ChartTitle.Characters.Text=graph[0]</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; wb.Charts(graph[6]).Axes(1).MinimumScale=36530</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; #wb.Charts(graph[6]).Axes(1).MinimumScaleAuto=True</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; #wb.Charts(graph[6]).Axes(1).MinorUnitsAuto=True</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; #wb.Charts(graph[6]).Axes(1).MajorUnitsAuto=True</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; #wb.Charts(graph[6]).Axes(1).Crosses=xlAutomatic</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; xl.ActiveWorkbook.Close(SaveChanges=1)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; except:</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; raise</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; xl.ActiveWorkbook.Close(SaveChanges=1)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; #Quit Excel</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; xl.Quit</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; del xl</font>
<br>
<br>
<br>
<br><font size=2 face="sans-serif">HTHT</font>
<br>
<br><font size=2 face="sans-serif">Eric</font>
<br>
<br><font size=2 face="sans-serif">Eric B. Powell<br>
E&amp;GIS<br>
BSRI<br>
(803)952-7783<br>
<br>
When a true genius appears in this world you may know him by this sign,
that the dunces are all in confederacy against him. (Swift)</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>Fabrice Capiez &lt;fabrice_capiez@yahoo.co.jp&gt;</b>
</font>
<br><font size=1 face="sans-serif">Sent by: python-win32-bounces+eric.powell=srs.gov@python.org</font>
<p><font size=1 face="sans-serif">06/29/2005 06:23 PM</font>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td><font size=1 face="sans-serif">Bob Gailer &lt;bgailer@sbcglobal.net&gt;</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td><font size=1 face="sans-serif">python-win32@python.org</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td><font size=1 face="sans-serif">Re: [python-win32] Unable to set an
Excel chart's titl ethrough win32com : can you reproduce this problem ?</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=2><tt><br>
<br>
&gt; <br>
&gt; According to Excel Visual Basic Help: &quot;Characters - Returns a
<br>
&gt; &lt;mk:@MSITStore:C:\Program%20Files\Microsoft%20Office\Office\1033\VBAXL9.CHM::/<br>
html/xlobjCharacters.htm&gt;Characters <br>
&gt; object that represents a range of characters within the object text.
You <br>
&gt; can use the Characters object to format characters within a text string.<br>
&gt; <br>
&gt; Now look at the Text property &quot;Returns or sets the text for the
specified <br>
&gt; object. Read-only String for the Range object, read/write String for
all <br>
&gt; other objects.&quot;<br>
&gt; <br>
&gt; So try chart.ChartTitle.Text =&quot;title&quot;<br>
&gt; <br>
<br>
Actually I tried both ChartTitle.Text and ChartTitle.Characters.Text<br>
The VBA macro recorder uses Characters.Text to set the title but at first
I <br>
thought that this object was only due to my Japanese version of Office,
so I<br>
 tried with both possibilities at every step of my testing. <br>
Now I think that the problem lies in copying a chart from one place to
<br>
another since the problem arises with both Copy and Location methods..
<br>
Either there is a problem with win32com, or the com interface of the object
<br>
is bugged, or I am not using things the right way altogether.<br>
<br>
Thank you for the insight anyway<br>
<br>
Fabrice Capiez <br>
__________________________________<br>
Save the earth<br>
http://pr.mail.yahoo.co.jp/ondanka/<br>
<br>
_______________________________________________<br>
Python-win32 mailing list<br>
Python-win32@python.org<br>
http://mail.python.org/mailman/listinfo/python-win32<br>
</tt></font>
<br>