Jump to content

AutoIt Excel COM usage.


yashSE
 Share

Recommended Posts

I have been searching for an answer from the past two days.

Please let me know if anyone could help me on this?

here is my code;

Local $aTableData = _IETableWriteToArray($oTab, True)
Local $iRows = UBound($aTableData, $UBOUND_ROWS)
$oExcel = ObjCreate("Excel.Application")
With $oExcel
    .Visible = True
    .WorkBooks.Add
    .ActiveWorkbook.Sheets(1).Select()
EndWith
Global $xlMaximized = -4137
$oExcel.Application.Activewindow.WindowState = $xlMaximized
For $i = 1 To $iRows - 1
                  $oExcel.ActiveSheet.Cells($i,1).Value = $aTableData[$i][1]
                  $oExcel.ActiveSheet.Cells($i,2).Value = $aTableData[$i][3]
                  $oExcel.ActiveSheet.Cells($i,3).Value = $aTableData[$i][4]
                  If $aTableData[$i][3] == " Running" And $aTableData[$i][4] == " Enabled"  Then
                               $oExcel.ActiveSheet.Cells($i,4).Value = "All OK"
                               $oExcel.ActiveSheet.Cells($i,4).Interior.ColorIndex = 4
                  Else
                               $oExcel.ActiveSheet.Cells($i,4).Value = "Not OK"
                               $oExcel.ActiveSheet.Cells($i,4).Interior.ColorIndex = 3
                  EndIf
   Next

Till here my code works perfectly.

now i`m trying to activate my source bring out the data into an array and do the same thing again but this time i wanted add the data to the same excel as above but in the next sheet and then save the excel.

 

Could anyone guide me on this?

 

Thanks you very mcuh in advance.

Edited by Melba23
Link to comment
Share on other sites

Hello, and welcome.  Have you taken a look at the Excel UDF in the help file?  It uses a COM approach and has many functions pre-packaged.  There is also a wiki with lots more examples.  _Excel_RangeRead has a workbook and worksheet parameter and will read your range as an array.

Edited by Jfish

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...