Jump to content
Macro Express Forums
Scott_W

Using <Ctrl>G in Excel to Goto Label

Recommended Posts

Hello,

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.

 

 

Share this post


Link to post
Share on other sites

Text Type (Simulate Keystrokes): <CONTROL>g

Works for me. 

  • Thanks 1

Share this post


Link to post
Share on other sites

Cory...... - Macro-Master........     Thank you.

Can't believe I was beating on all those other - unproductive options.   It worked.

Thanks again,

Scott

 

Share this post


Link to post
Share on other sites

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

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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....

Share this post


Link to post
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?

Share this post


Link to post
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. 

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×