Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
| guides:com:excel.application [2022-02-27 15:06] – ↷ Page moved from ahk:com:excel.application to guides:com:excel.application geek | guides:com:excel.application [2022-02-27 15:59] (current) – Adding content geek | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Excel.Application ====== | ====== Excel.Application ====== | ||
| - | CLSID: '' | + | //Original post by [[user:Learning one]] on the [[https:// |
| - | Documentation Link: [[https:// | + | ---- |
| + | |||
| + | **COM Object:** '' | ||
| + | |||
| + | **Purpose: | ||
| + | |||
| + | **System Requirements: | ||
| + | |||
| + | **Documentation Link:** [[https:// | ||
| + | |||
| + | **Other Links:** [[http:// | ||
| + | |||
| + | **Basic Code Example: | ||
| + | |||
| + | <code AutoHotkey> | ||
| + | oExcel := ComObjCreate(" | ||
| + | oExcel.Workbooks.Add ; create a new workbook (oWorkbook := oExcel.Workbooks.Add) | ||
| + | |||
| + | oExcel.Range(" | ||
| + | oExcel.Range(" | ||
| + | oExcel.Range(" | ||
| + | |||
| + | oExcel.Range(" | ||
| + | oExcel.Range(" | ||
| + | oExcel.Range(" | ||
| + | oExcel.Range(" | ||
| + | |||
| + | A1 := oExcel.Range(" | ||
| + | oExcel.Range(" | ||
| + | oExcel.Visible := 1 ; make Excel Application visible | ||
| + | MsgBox | ||
| + | ExitApp | ||
| + | </ | ||
| + | |||
| + | |||
| + | **How to access Workbook without opening it?** | ||
| + | |||
| + | <code AutoHotkey> | ||
| + | FilePath := " | ||
| + | oWorkbook := ComObjGet(FilePath) ; access Workbook object | ||
| + | MsgBox | ||
| + | </ | ||
| + | |||
| + | |||
| + | **How to access active Excel Application object?** | ||
| + | |||
| + | Use '' | ||
| + | |||
| + | |||
| + | **How to access active Workbook? | ||
| + | |||
| + | <code AutoHotkey> | ||
| + | try | ||
| + | oWorkbook := Excel_Get().ActiveWorkbook ; try to access active Workbook object | ||
| + | catch | ||
| + | return ; case when Excel doesn' | ||
| + | |||
| + | ; if there is active workbook, code continues execution... | ||
| + | oWorkbook.ActiveSheet.Range(" | ||
| + | </ | ||
| + | |||
| + | |||
| + | **How to access Excel object from Workbook object?** | ||
| + | |||
| + | <code AutoHotkey> | ||
| + | oExcel := oWorkbook.Application ; returns Excel application object that owns Workbook object | ||
| + | </ | ||
| - | ColorIndex Values: http:// | ||