newbie28 Posted June 30, 2009 Share Posted June 30, 2009 Hello, I want to use _ExcelWriteCell with whatever excel workbook is currently active, but I'm not sure how to set $oExcel in order to do this. Any suggestions? Thank you!! Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 30, 2009 Share Posted June 30, 2009 I want to use _ExcelWriteCell with whatever excel workbook is currently active, but I'm not sure how to set $oExcel in order to do this. Any suggestions? Thank you!!_ExcelAttach() 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 Link to comment Share on other sites More sharing options...
newbie28 Posted June 30, 2009 Author Share Posted June 30, 2009 Is there a way to set any open workbook as the object, whatever file name it might have? Right now, I can only get it to work if I know the exact title/filename of the workbook. Thank you! Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 30, 2009 Share Posted June 30, 2009 (edited) Is there a way to set any open workbook as the object, whatever file name it might have? Right now, I can only get it to work if I know the exact title/filename of the workbook. Thank you! Get the window title using the class (i.e. WinGetTitle("[CLASS:XLMAIN]", "")). Then use that in _ExcelBookAttach() with the "Title" parameter. Edited June 30, 2009 by PsaltyDS 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 Link to comment Share on other sites More sharing options...
newbie28 Posted July 1, 2009 Author Share Posted July 1, 2009 Awesome, thank you!! Link to comment Share on other sites More sharing options...
Malkey Posted July 1, 2009 Share Posted July 1, 2009 To help others who search these forums for assistance, here is an example of using _ExcelBookAttach () to write to the cell of an open Excel worksheet / workbook. ; ; http://www.autoitscript.com/forum/index.php?s=&showtopic=97570&view=findpost&p=701571 #include <Excel.au3> Local $sExcelWinTitle, $oExcel $sExcelWinTitle = WinGetTitle("[CLASS:XLMAIN]", "") If $sExcelWinTitle <> "" Then $oExcel = _ExcelBookAttach($sExcelWinTitle, "Title") WinActivate("[CLASS:XLMAIN]", "") For $i = 1 To 20;Loop _ExcelWriteCell($oExcel, " I Wrote to This Cell", $i, 1);Write to the Cell Next EndIf ; newbie28 should have posted a solution for those who follow in his footsteps - like me. Thanks PsaltyDS. Link to comment Share on other sites More sharing options...
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