Page 1 of 1

Excel COM

Posted: 18 May 2018, 12:22
by Vh_
Hello,

I'm trying to find the equivalent of xlToRight for xlToLeft. Does anyone know what number should be defined as xlToLeft, and also where this number comes from? I'm trying to get to column A.

Code: Select all

XL := ComObjActive("Excel.Application")

xlToRight :=  -4161 ;this works
XL.Selection.End(xltoRight).Select

;Need to find out the number for xlToLeft
xlToLeft :=  -###?
XL.Selection.End(xltoLeft).Select
Any help with this is appreciated!

Thanks,
Vh

Re: Excel COM  Topic is solved

Posted: 18 May 2018, 12:40
by jeeswg
ms%20office%20constants%20(excel).ahk
https://raw.githubusercontent.com/jeesw ... excel).ahk

xlToLeft := -4159
xlToRight := -4161

You can use MsgBox from within Excel macros to report the values of constants.

Re: Excel COM

Posted: 18 May 2018, 12:51
by Vh_
Fantastic! Thanks jeeswg!

Re: Excel COM

Posted: 18 May 2018, 15:21
by FanaticGuru
Vh_ wrote:I'm trying to find the equivalent of xlToRight for xlToLeft. Does anyone know what number should be defined as xlToLeft, and also where this number comes from? I'm trying to get to column A.
Another way is while you are in Excel, you can hit Alt-F11 to open the Visual Basic Editor, then hit Ctrl-G to open Immediate panel, then enter "?xlToRight" and hit enter. Basically a ? mark and any constant to report the value of that constant.

FG

Re: Excel COM

Posted: 24 May 2018, 08:49
by Vh_
Thanks FanaticGuru! Very helpful!
FanaticGuru wrote:
Vh_ wrote:I'm trying to find the equivalent of xlToRight for xlToLeft. Does anyone know what number should be defined as xlToLeft, and also where this number comes from? I'm trying to get to column A.
Another way is while you are in Excel, you can hit Alt-F11 to open the Visual Basic Editor, then hit Ctrl-G to open Immediate panel, then enter "?xlToRight" and hit enter. Basically a ? mark and any constant to report the value of that constant.

FG