[python-win32] Python Excel - 2 workbooks affect each other[SEC=UNCLASSIFIED]
Stefanie Lück
lueck at ipk-gatersleben.de
Wed Mar 2 12:38:54 CET 2011
Hello!
Thanks for the answers and pointing me to paste/copy references of Excel! I
solved the problem by adding self.xlApp.CutCopyMode = False into my excel
code just after I call self.xlApp = Dispatch ('Excel.Application').
I still dont know how Excel keep the reference from coping data into
another program, save the data from the clipboard in a text (!) file,
writing the proceeded data from a text file into a new created Excel
workbook
But anyway, I solved it :-)
Thanks and kind regards,
Stefanie
_____
Von: python-win32-bounces+lueck=ipk-gatersleben.de at python.org
[mailto:python-win32-bounces+lueck=ipk-gatersleben.de at python.org] Im Auftrag
von Andrew MacIntyre
Gesendet: Dienstag, 1. März 2011 01:15
An: python-win32 at python.org
Betreff: Re: [python-win32] Python Excel - 2 workbooks affect each
other[SEC=UNCLASSIFIED]
[apologies for top post]
Im far from an expert, or even experienced, in Excel however the term
paste rings bells. Behind the scenes, material in the clipboard has lots
of metadata and a selection copied from one open workbook includes the
references to that workbook so when you paste it Excel includes those
references and effectively links the pasted to cells to the pasted from
cells. If you must use paste, then you will probably need to use paste
special and select values this should break the references back to the
original source.
If you carefully look at the formula of a pasted cell, you might see how
the source workbook & worksheet are identified I know that this sort of
thing is visible when using the function wizard with such Excel functions
as VLOOKUP.
-------------------------> "These thoughts are mine alone!" <---------
Andrew MacIntyre Operations Branch
tel: +61 2 6219 5356 Communications Infrastructure Division
fax: +61 2 6253 3277 Australian Communications & Media Authority
email: andrew.macintyre at acma.gov.au http://www.acma.gov.au/
From: python-win32-bounces+andrew.macintyre=acma.gov.au at python.org
[mailto:python-win32-bounces+andrew.macintyre=acma.gov.au at python.org] On
Behalf Of Stefanie Lück
Sent: Tuesday, 1 March 2011 1:19 AM
To: python-win32 at python.org
Subject: [python-win32] Python Excel - 2 workbooks affect each other
Hello!
I have a strange excel behaviour if 2 workbooks are open. Im trying to
create an excel workbook with a bar chart from some data which comes from my
wxPython program. If I paste the data into my program from any source except
another excel file, everything works as expected. But if I copy the values
from a source excel workbook into my program and then try to create a new
excel workbook with a chart, the new workbook takes the data of the chart
from the source workbook and not from the sheet I specified. This happens
only if the data of the source workbook are still selected from the copy
before, if I click into another cell, my new created workbook will use the
data of its sheet which I specified.
Does anybody know what this could be? In my code I clearly specify to use
the data of my new created worksheet. The name of the source workbook sheet
is completely different. Looks like excel ignore it and use the currently
selected data of any workbook. Is there a way to specify the Workbook and
Worksheet, which I want to use?
Any help would be appreciated!
Thanks,
Stefanie
NOTICE: This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any unauthorized
review, use, disclosure or distribution is prohibited. If you are not the
intended recipient, please contact the sender by reply email and destroy all
copies of the original message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20110302/dc2f28a7/attachment.html>
More information about the python-win32
mailing list