<div dir="ltr">Dear all, <br><br>I have a problem with talking to Excel. Somehow the command Workbooks.Add() gives me problems?<br>If I open a workbook in Excel, then I get the trace back below. I can not say that I quite understand why this does not work. Any insights would be highly appreciated.<br>
<br>If I &quot;manually&quot; open the workbook, I can fill the data in the sheet<br><br>Johan<br><br><br>&gt;&gt;&gt; from win32com.client import Dispatch<br>&gt;&gt;&gt; xlApp = Dispatch(&quot;Excel.Application&quot;)<br>
&gt;&gt;&gt; xlApp.Visible = 1<br>&gt;&gt;&gt; xlApp.Workbooks.Add()<br><br>Traceback (most recent call last):<br>&nbsp; File &quot;&lt;pyshell#67&gt;&quot;, line 1, in &lt;module&gt;<br>&nbsp;&nbsp;&nbsp; xlApp.Workbooks.Add()<br>&nbsp; File &quot;c:\pythonxy\python\lib\site-packages\pywin32-2.11-py2.5-win32.egg\win32com\client\dynamic.py&quot;, line 467, in __getattr__<br>
&nbsp;&nbsp;&nbsp; if self._olerepr_.mapFuncs.has_key(attr): return self._make_method_(attr)<br>&nbsp; File &quot;c:\pythonxy\python\lib\site-packages\pywin32-2.11-py2.5-win32.egg\win32com\client\dynamic.py&quot;, line 295, in _make_method_<br>
&nbsp;&nbsp;&nbsp; methodCodeList = self._olerepr_.MakeFuncMethod(self._olerepr_.mapFuncs[name], methodName,0)<br>&nbsp; File &quot;c:\pythonxy\python\lib\site-packages\pywin32-2.11-py2.5-win32.egg\win32com\client\build.py&quot;, line 297, in MakeFuncMethod<br>
&nbsp;&nbsp;&nbsp; return self.MakeDispatchFuncMethod(entry, name, bMakeClass)<br>&nbsp; File &quot;c:\pythonxy\python\lib\site-packages\pywin32-2.11-py2.5-win32.egg\win32com\client\build.py&quot;, line 318, in MakeDispatchFuncMethod<br>&nbsp;&nbsp;&nbsp; s = linePrefix + &#39;def &#39; + name + &#39;(self&#39; + BuildCallList(fdesc, names, defNamedOptArg, defNamedNotOptArg, defUnnamedArg, defOutArg) + &#39;):&#39;<br>
&nbsp; File &quot;c:\pythonxy\python\lib\site-packages\pywin32-2.11-py2.5-win32.egg\win32com\client\build.py&quot;, line 604, in BuildCallList<br>&nbsp;&nbsp;&nbsp; argName = MakePublicAttributeName(argName)<br>&nbsp; File &quot;c:\pythonxy\python\lib\site-packages\pywin32-2.11-py2.5-win32.egg\win32com\client\build.py&quot;, line 542, in MakePublicAttributeName<br>
&nbsp;&nbsp;&nbsp; return filter( lambda char: char in valid_identifier_chars, className)<br>&nbsp; File &quot;c:\pythonxy\python\lib\site-packages\pywin32-2.11-py2.5-win32.egg\win32com\client\build.py&quot;, line 542, in &lt;lambda&gt;<br>&nbsp;&nbsp;&nbsp; return filter( lambda char: char in valid_identifier_chars, className)<br>
UnicodeDecodeError: &#39;ascii&#39; codec can&#39;t decode byte 0x83 in position 52: ordinal not in range(128)<br>&gt;&gt;&gt; <br></div>