Excel COM Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Vh_
Posts: 201
Joined: 17 Mar 2017, 22:06

Excel COM

18 May 2018, 12:22

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
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Excel COM  Topic is solved

18 May 2018, 12:40

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.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Vh_
Posts: 201
Joined: 17 Mar 2017, 22:06

Re: Excel COM

18 May 2018, 12:51

Fantastic! Thanks jeeswg!
FanaticGuru
Posts: 1411
Joined: 30 Sep 2013, 22:25

Re: Excel COM

18 May 2018, 15:21

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
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

[Function] Timer - Create and Manage Timers
Vh_
Posts: 201
Joined: 17 Mar 2017, 22:06

Re: Excel COM

24 May 2018, 08:49

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

Return to “Ask For Help”

Who is online

Users browsing this forum: Epialis, Google [Bot], lexikos, Smile_ and 41 guests