Snow1 Posted June 30, 2011 Share Posted June 30, 2011 I would appreaciate some help on this one.. I have a script sending data to an application from excel. This could be a large number of transfers. I have a listbox in Excel that I'll watch as these numbers are transfered. What I would like is for this listbox to show each transfer after it happens. I'm trying to use the following script (because I don't know any better!) Do _ExcelWriteCell($oExcel,$sCellValue, "A2") ;From Data Sheet Send($sCellValue _ExcelWriteCell($oExcel,$sCellValue, "B2") ;From Data Sheet Send($sCellValue _ExcelWriteCell($oExcel,$sCellValue, "C2") ;From Data Sheet Send($sCellValue _ExcelRowDelete($oExcel, 2, 1) ;Delete Row 2 ;The next hundred or so rows move up ;starts over ;Here is where I would like it to update the row source on Userform3.Listbox3., before it "loops" ;I have this now to refresh but of course it doesn't work... _ExcelActivate($oExcel,Userform3.listbox3.RowSource = "Data2!A1:C200") ;starts over Until $sCellvalue = "" Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 1, 2011 Share Posted July 1, 2011 Why all the row deletion? Read the sheet once to an array and loop through the array: $aData = _ExcelReadSheetToArray($oExcel) For $r = 2 To $aData[0][0] For $c = 1 To 3 ConsoleWrite("Row: " & $r & "; Col: " & $c & " = " & $aData[$r][$c] & @LF) Next 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...
Snow1 Posted July 1, 2011 Author Share Posted July 1, 2011 Thank you for your reply however it doesn't answer my question. There are too many variables to make an array, I would just like to know if it's even possible to update the rowsource from the script after each of the data blocks have been transfered. Thanks again. Link to comment Share on other sites More sharing options...
Snow1 Posted July 1, 2011 Author Share Posted July 1, 2011 Perhaps I could just run a macro at that point? Unfortunatly I can't find anything that tells me how to run a macro from the script. Any help here? Thanks... Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 1, 2011 Share Posted July 1, 2011 (edited) The listbox has an .AddItem() method. So you can add the items to the listbox without using .RowSource at all by .AddItem($sCellValue).What I don't know how to do is reference the ListBox from the Excel objects. Don't have Excel here to experiment with.P.S. Perhaps I could just run a macro at that point? Unfortunatly I can't find anything that tells me how to run a macro from the script.I think it's just .Run("MyMacro"). Search the forum, we've answered this before. Edited July 1, 2011 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...
Snow1 Posted July 1, 2011 Author Share Posted July 1, 2011 Ok, I've created a macro named "RowSource". I've tried to call this macro ($oExcel.run("RowSource") but it just returns an error, with or without quote marks. I used _ExcelBookAttach for my script source. As for .additem. I'm just not that experienced with Autoit to use that. I've spent a few hours looking through the Forum also. Thanks for your help and patience. Link to comment Share on other sites More sharing options...
Snow1 Posted July 2, 2011 Author Share Posted July 2, 2011 I took a different approach. I assigned the macro Ctrl+q and in the script I put "Send("^{q}) and it works like a charm Have a great 4th... 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