Jump to content

rafaelcadina

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by rafaelcadina

  1. can you guys tell what's wrong? It keeps running till I hit ctrl+break #include <Excel.au3> ;wrote by rafael cadina, 03/04/2014 00:00 $Path="C:\Users\rafael.cadina\Desktop\jjj\Detailing Plan\2602 0859 Detailing Plan.xls" ;Set Full Path to Detailing Plan Excel File $ExcelWB=_ExcelBookAttach($Path) ;Do not change $ExcelWS="Vaccines_12 - PED" ;Select Worksheet from Detailing Plan Excel File $NYear=8 ;Number of years analyzed +1 $StratosWindow=("Stratos") ;Set Stratos Window Name $FirstRow=6 ;First Row Index Containing a Product $FirstColumn=2 ;First Column Index Containing a Product $YearRow=4 ;First Row Index Containing a Year $YearColumn=1 ;First Column Index Containing a Year $ComboBoxIndex=10 ;Do not change $WeightIndex=13 ;Do not change Global $YearRowArray[$NYear] ;years array _ExcelSheetActivate($ExcelWB,$ExcelWS) $YearRowArray[1]=$YearRow $YearCell=_ExcelReadCell($ExcelWB,$YearRow,$YearColumn) ;Set Rows For Each Year in Array For $k=2 To $NYear Do $YearRow=$YearRow+1 $YearCell=_ExcelReadCell($ExcelWB,$YearRow,$YearColumn) Until $YearCell<>"" $YearRowArray[$k]=$YearRow Next $i=$FirstRow $j=$FirstColumn $CellValue=_ExcelReadCell($ExcelWB,$i,$j) For $l=2 To $NYear While $CellValue<>"" While $CellValue<>"" ControlCommand($StratosWindow,"","TComboBox"&$ComboBoxIndex,"SelectString",$CellValue) ControlSetText($StratosWindow,"","TSmEdit"&$WeightIndex,_ExcelReadCell($ExcelWB,$i,$j+1)*100) $i=$i+1 $CellValue=_ExcelReadCell($ExcelWB,$i,$j) $ComboBoxIndex=$ComboBoxIndex-1 $WeightIndex=$WeightIndex-1 WEnd $i=$FirstRow $j=$j+2 $CellValue=_ExcelReadCell($ExcelWB,$i,$j) $ComboBoxIndex=10 $WeightIndex=13 ControlClick($StratosWindow,"",67984) WEnd $j=$FirstColumn $i=($YearRowArray[$l]+2) $CellValue=_ExcelReadCell($ExcelWB,$i,$j) Next
  2. Sorry, my fault. It works properly. How do i manage to select a specific Worksheet within the Excel File? Ty
  3. G'day guys. Hope you're doing fine. I wonder if it's possible to read cells data from excel from a file which is already opened. I've already read about _ExcelReadCell function, but it requires opening an excel file each time i run the script. As I work with many worksheets in a single workbook, it's not a good idea to open the Excel file for each sheet i need to work with. Do you know any workaround? Thank you very much!
×
×
  • Create New...