Skip to content

Instantly share code, notes, and snippets.

@emisjerry
Created November 8, 2019 13:54
Show Gist options
  • Save emisjerry/89a652158faf8e53f615a7796dbdb399 to your computer and use it in GitHub Desktop.
Save emisjerry/89a652158faf8e53f615a7796dbdb399 to your computer and use it in GitHub Desktop.
;; 列出Excel.Application能使用的顏色碼
;ComObjError(false) ; Disable COM Object error notification
excelApp := ComObjCreate("Excel.Application")
workBook := excelApp.Workbooks.Add
excelApp.Visible := True
workBook.ActiveSheet.Columns("B").ColumnWidth := 5
Loop 100
{
try
{
workBook.ActiveSheet.Range("A" . A_INDEX).Value := A_INDEX
excelApp.Range("B" . A_INDEX).Interior.ColorIndex := A_INDEX
} catch e {
;; do nothing
}
}
workBook.SaveAs("c:\temp\colors.xlsx")
workBook.Close()
Run, c:\temp\colors.xlsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment