Snow1 Posted June 17, 2011 Posted June 17, 2011 From a real newbe. I can't find any information on how to read/copy an excel cell value from an already opened workbook sheet.I can't use a read only. All I want to do is copy a cell value to paste into another windows application. Nothing I can find works, except Read Only! Thanks
Snow1 Posted June 17, 2011 Author Posted June 17, 2011 Help File --> Excel ManagementThanks for quick replyI looked there...it has OpenBookNew but that has blank cells. I just want to read/copy from the workbook already open.
MrMitchell Posted June 17, 2011 Posted June 17, 2011 (edited) Try _ExcelBookAttach() Then _ExcelReadCell() Edited June 17, 2011 by MrMitchell
Snow1 Posted June 17, 2011 Author Posted June 17, 2011 Try _ExcelBookAttach() Then _ExcelReadCell()Thank you but that won't work either. I guess Autoit doesn't work with an already opened workbook. I was trying to get away from SendKeys which does work but very unreliable!
MrMitchell Posted June 17, 2011 Posted June 17, 2011 (edited) Thank you but that won't work either. I guess Autoit doesn't work with an already opened workbook. I was trying to get away from SendKeys which does work but very unreliable!It does too work with a Workbook that's already open, that's what _ExcelBookAttach() does. How are you using the command?Edit1: You can make reference to your open workbook using 3 different strings: file name, full path and filename, or title of the Excel window.Edit2: Check out the 3 examples in the Help File, you'll get a good idea on how it works. Edited June 17, 2011 by MrMitchell
Snow1 Posted June 18, 2011 Author Posted June 18, 2011 It does too work with a Workbook that's already open, that's what _ExcelBookAttach() does. How are you using the command?Edit1: You can make reference to your open workbook using 3 different strings: file name, full path and filename, or title of the Excel window.Edit2: Check out the 3 examples in the Help File, you'll get a good idea on how it works.Well,I'm getting closer, thanks for your help. Now my problem is that it won't read a cell. I even use write to cell but it won't read it: This is what I have:$oExcel = _ExcelBookAttach("c:\Documents and Settings\dick\My Documents\Book1.xls")_ExcelWriteCell($oExcel, "Uploading", 1, 1)$sCellValue = _ExcelReadCell($oExcel, 1, 1) It writes "Uploading" to cell A1 but always reads "_ExcelWriteCell($oExcel, "Uploading", 1, 1)".No matter what it writes, the results are always the same.What am I doing wrong???Thanks again..
JoHanatCent Posted June 18, 2011 Posted June 18, 2011 What am I doing wrong??? Thanks again.. Maybe time to check if indeed you had a successful attachment? #Include <Excel.au3> $oExcel = _ExcelBookAttach("c:\Documents and Settings\dick\My Documents\Book1.xls") If @error = 1 Then MsgBox(0, "Error code is: "&@error, "Could not Attach Excel Book returning: " &$oExcel) _ExcelWriteCell($oExcel, "Uploading", 1, 1) $sCellValue = _ExcelReadCell($oExcel, 1, 1)
Snow1 Posted June 18, 2011 Author Posted June 18, 2011 Thanks to all your help I got the right script. have a great day..
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