PC Review


Reply
Thread Tools Rate Thread

Assign different keyboard shortcuts

 
 
wal
Guest
Posts: n/a
 
      26th Oct 2008
Excel 2003

I've just discovered Application.OnKey. I've put several assignments
in a Workbook_Open Event in ThisWorkbook in PERSONAL.XLS. This serves
a useful purpose, but only to a limited extent.

As far as I can tell, OnKey works to do the three following things:
- Disables an existing keyboard shortcut (by using "")
- Restores the default shortcut
- Adds a keyboard shortcut for a **MACRO**.

What I can't get OnKey to do is to assign a keyboard shortcut to a
built-in Excel dialog or other feature. For example, I'd like to
assign F3 to Find Next, currently assigned to Shift-F4. (I inevitably
hit Ctrl-F4 and close the workbook accidentally.) Does OnKey work for
this? If so, how? Or is there another method?

Thanks.



 
Reply With Quote
 
 
 
 
Gary''s Student
Guest
Posts: n/a
 
      26th Oct 2008
Most Dialogs can be evoked from macros. So have the OnKey call a macro (or
assign a macro shortcut in the usual way) and then have the macro open the
Dialog:

Sub servient()
fname = Application.GetOpenFilename()
Workbooks.Open (fname)
End Sub

--
Gary''s Student - gsnu200810


"wal" wrote:

> Excel 2003
>
> I've just discovered Application.OnKey. I've put several assignments
> in a Workbook_Open Event in ThisWorkbook in PERSONAL.XLS. This serves
> a useful purpose, but only to a limited extent.
>
> As far as I can tell, OnKey works to do the three following things:
> - Disables an existing keyboard shortcut (by using "")
> - Restores the default shortcut
> - Adds a keyboard shortcut for a **MACRO**.
>
> What I can't get OnKey to do is to assign a keyboard shortcut to a
> built-in Excel dialog or other feature. For example, I'd like to
> assign F3 to Find Next, currently assigned to Shift-F4. (I inevitably
> hit Ctrl-F4 and close the workbook accidentally.) Does OnKey work for
> this? If so, how? Or is there another method?
>
> Thanks.
>
>
>
>

 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      26th Oct 2008
Application.OnKey is all but obsolete. Just about all of the things that can
be done with it also have built in constants available in VBA to do the same
thing. It is sometimes useful in working with forms to simulate a keystoke
action, since the user cannot access the worksheet if the form is modal. I
suppose it is really a matter of design. If you design a program to work
without it, you don't miss it. If you design the program to run with it, it
can be useful. But it is not an essential facility to using VBA.

"wal" wrote:

> Excel 2003
>
> I've just discovered Application.OnKey. I've put several assignments
> in a Workbook_Open Event in ThisWorkbook in PERSONAL.XLS. This serves
> a useful purpose, but only to a limited extent.
>
> As far as I can tell, OnKey works to do the three following things:
> - Disables an existing keyboard shortcut (by using "")
> - Restores the default shortcut
> - Adds a keyboard shortcut for a **MACRO**.
>
> What I can't get OnKey to do is to assign a keyboard shortcut to a
> built-in Excel dialog or other feature. For example, I'd like to
> assign F3 to Find Next, currently assigned to Shift-F4. (I inevitably
> hit Ctrl-F4 and close the workbook accidentally.) Does OnKey work for
> this? If so, how? Or is there another method?
>
> Thanks.
>
>
>
>

 
Reply With Quote
 
Jim Rech
Guest
Posts: n/a
 
      26th Oct 2008
Sub AssignF3ToFindNext()
Application.OnKey "{F3}", "MyFindNext"
End Sub

Sub MyFindNext()
Cells.FindNext(Selection).Select
End Sub


--
Jim
"wal" <(E-Mail Removed)> wrote in message
news:2c904dfc-6cfe-49ce-8529-(E-Mail Removed)...
> Excel 2003
>
> I've just discovered Application.OnKey. I've put several assignments
> in a Workbook_Open Event in ThisWorkbook in PERSONAL.XLS. This serves
> a useful purpose, but only to a limited extent.
>
> As far as I can tell, OnKey works to do the three following things:
> - Disables an existing keyboard shortcut (by using "")
> - Restores the default shortcut
> - Adds a keyboard shortcut for a **MACRO**.
>
> What I can't get OnKey to do is to assign a keyboard shortcut to a
> built-in Excel dialog or other feature. For example, I'd like to
> assign F3 to Find Next, currently assigned to Shift-F4. (I inevitably
> hit Ctrl-F4 and close the workbook accidentally.) Does OnKey work for
> this? If so, how? Or is there another method?
>
> Thanks.
>
>
>



 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      26th Oct 2008
Forget that, I'm thinking SendKeys.

"JLGWhiz" wrote:

> Application.OnKey is all but obsolete. Just about all of the things that can
> be done with it also have built in constants available in VBA to do the same
> thing. It is sometimes useful in working with forms to simulate a keystoke
> action, since the user cannot access the worksheet if the form is modal. I
> suppose it is really a matter of design. If you design a program to work
> without it, you don't miss it. If you design the program to run with it, it
> can be useful. But it is not an essential facility to using VBA.
>
> "wal" wrote:
>
> > Excel 2003
> >
> > I've just discovered Application.OnKey. I've put several assignments
> > in a Workbook_Open Event in ThisWorkbook in PERSONAL.XLS. This serves
> > a useful purpose, but only to a limited extent.
> >
> > As far as I can tell, OnKey works to do the three following things:
> > - Disables an existing keyboard shortcut (by using "")
> > - Restores the default shortcut
> > - Adds a keyboard shortcut for a **MACRO**.
> >
> > What I can't get OnKey to do is to assign a keyboard shortcut to a
> > built-in Excel dialog or other feature. For example, I'd like to
> > assign F3 to Find Next, currently assigned to Shift-F4. (I inevitably
> > hit Ctrl-F4 and close the workbook accidentally.) Does OnKey work for
> > this? If so, how? Or is there another method?
> >
> > Thanks.
> >
> >
> >
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assign keyboard shortcuts Ms Microsoft Excel Worksheet Functions 0 26th Jan 2009 12:59 AM
Assign keyboard shortcuts to macros Edward Microsoft Powerpoint 0 9th Sep 2008 11:53 PM
How do I assign keyboard shortcuts myself? eg Keep with next? kt Microsoft Word New Users 15 25th Aug 2008 09:56 PM
Can I assign keyboard shortcuts for special characters in Excel 20 tyhubb Microsoft Excel Misc 1 15th Aug 2008 06:36 PM
Is it possible to assign keyboard shortcuts of my own? kang Microsoft Powerpoint 3 11th Jun 2007 10:42 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:46 PM.