hasantr wrote: ↑
14 May 2019, 02:43
Code: Select all
XL := ComObjCreate("Excel.Application")
Looks like you are creating instances of Excel without ever making them visible. And your script doesn't show quitting Excel or clearing the variables that contain COM objects. Both of these things can create hard-to-find problems for beginners. (especially if this is part of a larger script.) I suggest you use XL.visible := true
until you are confident in your ability to quit Excel using only the script. And clear any variables that contain COM objects when you are done with them. XL := ""
... do the same for any other COM vars. This allows the Excel process to close after you close the workbooks and quit Excel. Try restarting your computer before you test your script again.
hasantr wrote:Actually, I tried that too. There must be trouble on my computer. Because it didn't work that way either.
It would be helpful if you describe the exact error.
jeeswg's correction to your syntax appears to be correct, but I didn't test it in Excel. The code you had before would not work.
Klarion was correct about needing BGR. In VBA you have the RGB function, but in AHK you just assign a number., ex: ... := 0x1122FF
- where in this case 11
is the blue part, 22
is the green part, FF
is the red part. (decimal numbers work too, in addition to hex number, as long as it has the same value)