Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Create Excel application object
- Global $oExcel = ObjCreate("Excel.Application")
- ; Check if Excel was successfully created
- If IsObj($oExcel) Then
- ; Make Excel visible (optional)
- $oExcel.Visible = True
- ; Add a new workbook
- Global $oWorkbook = $oExcel.Workbooks.Add
- ; Activate the first sheet
- Global $oSheet = $oWorkbook.Sheets(1)
- $oSheet.Activate
- ; Write "Hello, AutoIt!" to cell A1
- $oSheet.Range("A1").Value = "Hello, autoit"
- $oSheet.Range("A2").Value = "Welcome, To Excel"
- ; Wait for a moment (optional)
- Sleep(2000)
- ; Save and close the workbook
- $oWorkbook.SaveAs(@ScriptDir & "\AutoItExcelExample.xlsx")
- $oWorkbook.Close
- ; Quit Excel
- $oExcel.Quit
- EndIf
Add Comment
Please, Sign In to add comment