Any way to send commands (not keystrokes) to Excel?

Get help with using AutoHotkey and its commands and hotkeys
perlsmith
Posts: 24
Joined: 13 Apr 2016, 21:44

Any way to send commands (not keystrokes) to Excel?

Post by perlsmith » 30 Jul 2020, 11:36

As you know, AHK spoils you - you can have infinite keyboard shortcuts.

In Excel : 52 at most (CTRL+letter and CTRL+SHIFT+letter)

So, is there some way you can send commands to Excel through some other interface that true Computer Science geeks are aware of?

For example, on Unix, I know you can send commands to NEdit and Firefox through a "server" interface (I think).

If you think of something or know of a resource, please share

Thanks!
Perl

User avatar
TheDewd
Posts: 1446
Joined: 19 Dec 2013, 11:16
Location: USA

Re: Any way to send commands (not keystrokes) to Excel?

Post by TheDewd » 30 Jul 2020, 11:46

Image Bulldozer - Sokoban inspired game from 1994 recreated in AutoHotkey.

perlsmith
Posts: 24
Joined: 13 Apr 2016, 21:44

Re: Any way to send commands (not keystrokes) to Excel?

Post by perlsmith » 30 Jul 2020, 11:56

Nice! https://support.microsoft.com/en-us/help/291392/excel-com-add-ins-and-automation-add-ins

kind of says a bit on what it is.

Still, scary for a lay person like me. I can do Excel macros, and AHK code. I need a white knight :)

Is there a Hello World tutorial anyone is aware of?

Basically, :

You do what you want in Excel with the Macro Recorder on so you capture the steps.
Then, you take the VBA code it captured and generalize it so you can use it at will.

Now, I need to "COM" this :) -- When AHK sees my key combo - something like ALT+right_arrow (something Excel won't dream of supporting) and tell Excel what to do.

Let's get our GDP back from COVID one automation step at a time :)

User avatar
TheDewd
Posts: 1446
Joined: 19 Dec 2013, 11:16
Location: USA

Re: Any way to send commands (not keystrokes) to Excel?

Post by TheDewd » 30 Jul 2020, 12:05

The link I provided has a "Hello World" example.

Like this:

Code: Select all

Alt & Right::
	XL := ComObjActive("Excel.Application")
	Xl.Range("A1").Value := "hello world!"
return
Is there something more specific we could write for you to help you with your task?
Image Bulldozer - Sokoban inspired game from 1994 recreated in AutoHotkey.

perlsmith
Posts: 24
Joined: 13 Apr 2016, 21:44

Re: Any way to send commands (not keystrokes) to Excel?

Post by perlsmith » 30 Jul 2020, 12:14

My bad.. only saw the "search for .."

Thanks, will do.

Post Reply

Return to “Ask For Help”