Created
November 8, 2019 13:54
-
-
Save emisjerry/553b6e9c43735fe0ba89146b0005364f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 列出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 | |
iCol := 0 | |
iRow := 1 | |
Loop 100 | |
{ | |
try | |
{ | |
workBook.ActiveSheet.Range("A" . A_INDEX).Value := A_INDEX | |
excelApp.Range("B" . A_INDEX).Interior.ColorIndex := A_INDEX | |
Random, iRandom, 1, 10000 | |
excelApp.Range("C" . A_INDEX).value := iRandom | |
oRange := excelApp.Range("C" . A_INDEX) | |
oRange.Font.Bold := 1 | |
oRange.Font.ColorIndex := A_INDEX | |
borders(oRange) | |
} catch e { | |
; Do nothing | |
} | |
} | |
workBook.SaveAs("c:\temp\colors.xlsx") | |
workBook.Close() | |
Run, c:\temp\colors.xlsx | |
borders(oRange) { | |
Loop 4 { | |
oRange.Borders(A_INDEX+6).LineStyle := 1 | |
oRange.Borders(A_INDEX+6).ColorIndex := 3 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment