sigil 0 Posted May 19, 2010 I'm trying to use Excelcom_UDF to attach to 2 workbooks at the same time, so that I can compare their contents and transfer data back and forth. But it seems like _ExcelAttach() changes all Excel objects to the most recently called workbook, so I can't have two separate objects. Here's the code I'm using: #include <excelcom_udf.au3> #include <array.au3> $frompath="path\book1.xls" $topath="path\book2.xls" $fromobj=_excelattach($frompath) $fromarray=_excelreadarray($fromobj,2,1,252,1) $toobj=_excelattach($topath) _arraydisplay($fromarray) This works fine, it displays data from the workbook specified by $frompath. But if I put the $fromarray assignment after the $toobj assignment, like this: #include <excelcom_udf.au3> #include <array.au3> $frompath="path\book1.xls" $topath="path\book2.xls" $fromobj=_excelattach($frompath) $toobj=_excelattach($topath) $fromarray=_excelreadarray($fromobj,2,1,252,1) _arraydisplay($fromarray) it displays data from the $topath workbook. Apparently calling _excelattach($topath) affects the object i created using _excelattach($frompath) as well. How can I make objects for two different Excel sheets? Share this post Link to post Share on other sites
PsaltyDS 41 Posted May 19, 2010 Use the standard UDF Excel.au3 that comes with AutoIt and _ExcelBookAttach(). Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Share this post Link to post Share on other sites