Jump to content
Macro Express Forums

Using <Ctrl>G in Excel to Goto Label

Recommended Posts


Migrating a useful script that copies/pastes content from my visitors registry to Notepad and just moving the cursor down the page

with an <Enter> keystroke works fine.

However, now I want to manage my entries in Excel so I can organize them better.  If I manually navigate my excel spreadsheet to

each pre-defined LABEL using the <Ctrl>G keystroke combination, my cursor jumps to the appropriate cell.  Why can't Macro Express-Pro

do the same?


I've tried the following, and a few variations; but none will activate the "Goto" feature in Excel. (even with delays built in like this)

<DELAY Flags="\x01" Time="2"/>
<TEXT TYPE Action="0" Text="<CTRLD>"/>
<DELAY Flags="\x02" Time="500"/>
<TEXT TYPE Action="0" Text="G"/>
<DELAY Flags="\x02" Time="500"/>
<TEXT TYPE Action="0" Text="<CTRLU>"/>
<DELAY Flags="\x01" Time="1"/>
<TEXT TYPE Action="0" Text="Friend_Family<ENTER>"/>
<DELAY Flags="\x01" Time="1"/>


I've even tried this -   <TEXT TYPE Action="0" Text="<CONTROL>"/>

Variations of Double-Control, etc....even placing them on the same line.


Any ideas?

Thanks in advance.



Link to comment
Share on other sites

8 hours ago, acantor said:

My guess is that Excel does not have focus when you activate the Popup menu item. If that's the case, Excel is not receiving the key combination.

Thank you for this follow-up.  I do/did have preceding Focus & Wait For commands to ensure Excel focus first.....and navigated one cell down before trying to execute the crtl-G.

It was the use of the capital G in Ctrl-G that caused the problem.  Using Ctrl-g worked.   In fact, after comparing similar scripts from my past works, I realized that I didn't use caps in Excel before; but did get away with CAPS in Notepad.   Subtle differences....

Link to comment
Share on other sites

On 4/26/2018 at 11:35 PM, amonaghan said:

Oddly, when I try <Control>g from a Popup Menu, it doesn't work. That is, a menu item which simply has the command -

Text Type (Simulate Keystrokes): <CONTROL>g


I agree with @acantor about the likely cause.

Most of my Excel macros are in pop-menus and their initial commands ensure that the target workbook/worksheet is activated. Sometimes automatically (e.g. with a Window Activate), or  manually (e.g. with a TBD like "Ensure the target worksheet is selected. Then close this to continue").

BTW, I've (re) learnt a little Excel VBA recently and wherever possible I try to do the task with that, particularly if operating on multiple cells/rows/columns, as it's so much faster than MEP. Or combine VBA macros with the MEP macro.

P.S: Did you get your scheduled macros working?

Link to comment
Share on other sites

You're welcome. I think many people get stuck on the idea that you need to issue up/down because they exist. But in my experience it's rare one needs it. Usually for something like multiple keystrokes. Remember, CTRL, ALT, Shift, Win are all modifier keys and don't have values. They're like an adjective. 

Link to comment
Share on other sites

I'm with Cory. I rarely find wrap key presses with up and down modifiers, and my MEP scripts generally work as expected.

The only time I have noticed that up and down modifiers make a difference is when I uncheck "Wait for the hotkey to be released before  activating." But I find MEP scripts that are activated upon hotkey press are flaky and unreliable. So I rarely use this feature.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...