ojef1 Posted March 17, 2011 Posted March 17, 2011 (edited) I've been looking through the help file and I see some of the examples using commands such as #include <Excel.au3> Local $oExcel = _ExcelBookNew() ;Create new book, make it visible [b]$iNumberOfWorksheets = $oExcel.Worksheets.Count[/b] MsgBox(0, "", $oExcel.Worksheets.Count) _ExcelSheetActivate($oExcel, 2) Is there a list somewhere of all the Excel Object commands ($oExcel.-----.----)? Edited March 17, 2011 by ojef1
hannes08 Posted March 17, 2011 Posted March 17, 2011 Hi ojef1,you could take a look at VBA help, which gives you a good overview of the objects, methods and attributes Excel is working with. Here's a link to the MSDN Excel VBA Language Reference: LinkIt's a compiled help file. Browse and have fun! Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
water Posted March 17, 2011 Posted March 17, 2011 (edited) For Excel 2007 the Object Model Reference can be found here.For Excel 2010 the Object Model Reference can be found here. Edited March 17, 2011 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
ojef1 Posted March 17, 2011 Author Posted March 17, 2011 Thanks those should help a lot. Is it not possible to open up and reference two separate excel objects without switching between the two?
water Posted March 17, 2011 Posted March 17, 2011 If you want to open two Excel worksheets at the same time - then it's possible. Global $oExcelNew = _ExcelBookNew() Global $oExcelExist = _ExcelBookOpen("C:\temp\test.xls") $sCell = _ExeclReadcell($oExcelExist, "A1") _ExcelWriteCell($oExcelNew, $sCell, "A1") Opens an existing and a new Excel workbook, takes cell 1 from the existing workbook and writes it to the new one. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
ojef1 Posted March 17, 2011 Author Posted March 17, 2011 That's what I thought but the errors I was getting made me believe otherwise so I combined the two into the same spreadsheet on separate sheets...That wasn't the problem though. Unfortunately, it's hard to tell what the issue is now. The reason I asked my original question is because (among other things) it would be really helpful to be able to search for a string (stored in a cell on spreadsheet A) on spreadsheet B without manually activating the window and using excels find function. Sort of like a VLookup but for excel objects I was hoping to run all of the excel stuff in the background without having to constantly switch between windows.
water Posted March 17, 2011 Posted March 17, 2011 If you want to open two Excel worksheets at the same time - then it's possible. Global $oExcelNew = _ExcelBookNew() Global $oExcelExist = _ExcelBookOpen("C:\temp\test.xls") $sCell = _ExeclReadcell($oExcelExist, "A1") _ExcelWriteCell($oExcelNew, $sCell, "A1") Opens an existing and a new Excel workbook, takes cell 1 from the existing workbook and writes it to the new one. I've never tested it myself but I will have a look at it tomorrow and see what error messages I get. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
ojef1 Posted March 17, 2011 Author Posted March 17, 2011 No I think you're right that should work fine...there's something wrong here I'll keep working at it though and report back if neccessary thanks for the help
water Posted March 18, 2011 Posted March 18, 2011 I think you're mixing up two things. One is the COM (Component Object Model) which is used by the UDF to access Excel and the other is the GUI you control using keyboard and mouse. Everything you do with mouse and keyboard can be done with the UDF or directly in your script. Have a look in the help file for the Excel UDF. If you don't find the functions you need then search the forum for ExcelCOM UDF. That's an expanded Excel UDF. If you still didn't find what you need then please ask again My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
water Posted March 18, 2011 Posted March 18, 2011 I think you're mixing up two things. One is the COM (Component Object Model) which is used by the UDF to access Excel and the other is the GUI you control using keyboard and mouse.Everything you do with mouse and keyboard can be done with the UDF or directly in your script.Have a look in the help file for the Excel UDF. If you don't find the functions you need then have a look a the That's an expanded Excel UDF.If you still didn't find what you need then please ask again My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now