mdelatorre icon

AutoIt for Excel

mdelatorre | PRO | 12/08/24 03:45:40 AM UTC | 0 ⭐ | 440 👁️ | Never ⏰ | [excel, Macros, AutoIT]
AutoIt |

680 B

|

Source Code

|

0 👍

/

0 👎

; 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
 

Comments