Twinlinked Posted July 14, 2011 Share Posted July 14, 2011 It seems so simple that it think i just be missing something. all i want is: I have two workbooks open in excel in the same instance of excel. I want to switch from one work book to the other. All i can get auto it to do is activate the last window in the excel instance that was activated (using winactivate). I have been given some scripts that create new files or open files, but i need to edit existing files, without reopening the files each time. is there a really simple way to do this? I am running Excel 2003 on XP Thanks A. Link to comment Share on other sites More sharing options...
Twinlinked Posted July 14, 2011 Author Share Posted July 14, 2011 OK i was able to use Ctrl +Tab, instead i knew there must be an easier way.. thanks A. Link to comment Share on other sites More sharing options...
bogQ Posted July 14, 2011 Share Posted July 14, 2011 (edited) I had identical problem with 2003, and its not autoit bug, its excel 2003 design, with other versions there arent any problems using win* commands to activate, even handle will not help in case with 2003. workbouk.activate shud do the trick (i think that that was the command name) if im not wrong and if i remamber correctly i created word object to read the office version (form some example on the forum), and if diffrent from 2003 then winactivate if not than the .activate option At the moment i dont have code, but i can geave it to you tomoro when i get to work and isolate the code from my project, that is if someone in the meantime dont provide you with similar solution and if i dont forget. Edited July 14, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
bogQ Posted July 15, 2011 Share Posted July 15, 2011 At the moment i dont have code, but i can geave it to you tomoro when i get to work and isolate the code from my project, that is if someone in the meantime dont provide you with similar solution and if i dont forget. Ok heare is the code im using, hope that it helps Dettecting office version $objWord = ObjCreate("Word.Application") Global $OfficeVerison = $objWord.Version $objWord.Quit Switch $OfficeVerison Case "7.0" $OfficeVerison = "97" Case "8.0" $OfficeVerison = "98" Case "9.0" $OfficeVerison = "2000" Case "10.0" $OfficeVerison = "2002" Case "11.0" $OfficeVerison = "2003" Case "12.0" $OfficeVerison = "2007" Case "14.0" $OfficeVerison = "2010" Case Else $OfficeVerison = "Too Old!" EndSwitch Activating the correct document If $OfficeVerison = "2003" Then $oExcel = ObjGet("","Excel.Application") If @error then Msgbox (0,"ExcelTest","Error Getting an active Excel Object. Error code: " & hex(@error,8)) Exit EndIf $oExcel.WorkBooks("GarancijePAKOM 1.4.xls").Activate Sleep(30) EndIf ;WinActivate ( "[CLASS:XLMAIN]" ) ;WinWaitActive ( "[CLASS:XLMAIN]" ) TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
alfa Posted July 18, 2011 Share Posted July 18, 2011 (edited) How about excel 2010 ? is it the same ? I have opened 2 excel files. $oExcel = ObjGet("","Excel.Application") $oExcel.WorkBooks("TK_LO_Cap_Rep.xls").Activate But this doesnt activate the excel windows that has TK_LO_Cap_Rep.xls. Is there something different with 2010 ? Edit: $oExcel.Visible = 1 $oExcel = ObjGet("","Excel.Application") $oExcel.WorkBooks("TK_LO_Cap_Rep.xls").Activate I put the .visible at the beginning and it is working now. Which wasnt hidden though :S Edited July 18, 2011 by alfa Link to comment Share on other sites More sharing options...
bogQ Posted July 18, 2011 Share Posted July 18, 2011 i still dont have 2010 to play around with probably this can help you http://msdn.microsoft.com/en-us/library/ff835568.aspx TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
alfa Posted July 20, 2011 Share Posted July 20, 2011 Thank you very much 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