theAutoitSpammer Posted April 26, 2009 Share Posted April 26, 2009 (edited) after reading and trying all suggestions I still can't make this function to work if the workbook is already open. is this a bug or a misuse or am i missing something? here is the simple script I'm trying to run: (the msgboxes are just for trouble shooting) ----------------------------------------------------------------------- #Include <Excel.au3> Opt("WinTitleMatchMode", 1) $title = WinGetTitle('Microsoft Excel') MsgBox(0,"",$Title) $oExcel = _ExcelBookAttach($title, 'Title') MsgBox(0,"",@error) ;----------------------------returns an error (error=1) $dTitle = _ExcelReadCell($oExcel, 1, 1) MsgBox(0,"",$dTitle) --------------------------------------------------------------------------- help please Edited April 28, 2009 by alram Link to comment Share on other sites More sharing options...
Developers Jos Posted April 26, 2009 Developers Share Posted April 26, 2009 Your code snippet works fine for me when testing it on one of my excel files. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
ResNullius Posted April 26, 2009 Share Posted April 26, 2009 (edited) @alram I suspect you're not getting an Excel COM instance created. Which version of Excel is installed? Or is it Open Office or just the Excel Viewer? Can you use any of the other Excel.au3 functions successfully? What does the message box show with this? #Include <Excel.au3> Opt("WinTitleMatchMode", 1) $title = WinGetTitle('Microsoft Excel') ;MsgBox(0,"",$Title) $oExcel = _ExcelBookAttach($title, 'Title') $err = @error MsgBox(0,"Well","IsObj($oExcel): " & IsObj($oExcel) & @CRLF & "@error: " & $err) $dTitle = _ExcelReadCell($oExcel, 1, 1) ;MsgBox(0,"",$dTitle) Edited April 26, 2009 by ResNullius Link to comment Share on other sites More sharing options...
theAutoitSpammer Posted April 27, 2009 Author Share Posted April 27, 2009 excel 2003 sp3 all other functions work this will work if i open or create a new book just before _ExcelBookAttach(), but not if the book is already open IsObj($oExcel):0 @error:1 i hope this tells you something......thanks for your help @alram I suspect you're not getting an Excel COM instance created. Which version of Excel is installed? Or is it Open Office or just the Excel Viewer? Can you use any of the other Excel.au3 functions successfully? What does the message box show with this? #Include <Excel.au3> Opt("WinTitleMatchMode", 1) $title = WinGetTitle('Microsoft Excel') ;MsgBox(0,"",$Title) $oExcel = _ExcelBookAttach($title, 'Title') $err = @error MsgBox(0,"Well","IsObj($oExcel): " & IsObj($oExcel) & @CRLF & "@error: " & $err) $dTitle = _ExcelReadCell($oExcel, 1, 1) ;MsgBox(0,"",$dTitle) Link to comment Share on other sites More sharing options...
ResNullius Posted April 27, 2009 Share Posted April 27, 2009 excel 2003 sp3all other functions workthis will work if i open or create a new book just before _ExcelBookAttach(), but not if the book is already openIsObj($oExcel):0 @error:1i hope this tells you something......thanks for your helpWell, I'm also using Excel 2003 w/ SP3.And, like Jos, your script works perfectly for me:I manually create a new Excel file or open an existing one, run your script and it works as expected.If the other Excel.au3 functions are working for you, I don't really know what else to tell you Link to comment Share on other sites More sharing options...
theAutoitSpammer Posted April 27, 2009 Author Share Posted April 27, 2009 (edited) i try in another 2 computers and worked!!!so now I'm thinking...excel settings or windows settings orregistry error or missing services or........................I'm going nuts thanks any way for your help , I'll post if I find the solution and ifyou can think in something let me know it will be much appreciated.Well, I'm also using Excel 2003 w/ SP3.And, like Jos, your script works perfectly for me:I manually create a new Excel file or open an existing one, run your script and it works as expected.If the other Excel.au3 functions are working for you, I don't really know what else to tell you Edited April 27, 2009 by alram Link to comment Share on other sites More sharing options...
theAutoitSpammer Posted April 28, 2009 Author Share Posted April 28, 2009 A REGISTRY CLEANING DID THE TRICK Link to comment Share on other sites More sharing options...
ResNullius Posted April 29, 2009 Share Posted April 29, 2009 A REGISTRY CLEANING DID THE TRICK Good to hear you got it working.But just a note: if you used a "registry cleaner" to do the job, you may have some other problems in future: they are notorious for stripping out empty entries that Microsoft somehow relies on when installing Office updates/Service packs! 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