Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default force keyboard (ALT) shortcuts in VBA Code?

Is it possible to force your vba code to use keyboard shortcuts - like "CTRL
+ C" or "ALT + E + C+ENTER" instead of "Selection.Copy".

The reason why I ask is that I have an add-in menu in Excel located between
the "Data" & "Windows" menus that I would like to access in a macro. The
shortcut would be "ALT +L+A+ENTER

Thanks,
Steve


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default force keyboard (ALT) shortcuts in VBA Code?

Steve,

The direct answer to your questions is to tell you to look at "SendKeys" in help.
A easier method would be to set a reference to the Add-in in Tools | References in the VBE.
That will allow you to call the macro using the run method...

Application.Run("MacroName")

Regards,
Jim Cone
San Francisco, CA

"Steve Mackay" wrote in message
...
Is it possible to force your vba code to use keyboard shortcuts - like "CTRL
+ C" or "ALT + E + C+ENTER" instead of "Selection.Copy".
The reason why I ask is that I have an add-in menu in Excel located between
the "Data" & "Windows" menus that I would like to access in a macro. The
shortcut would be "ALT +L+A+ENTER
Thanks,
Steve


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default force keyboard (ALT) shortcuts in VBA Code?

Thanks for the tip. I understand it in concept but can't seem to get it to
work in practice. So, to go back to my paste example, my code would look
like this?

Sub test()
Application.SendKeys ("%ep")
End Sub

But that doesn't seem to work correctly. Can you give me an example.
Sorry, I know this is probably very basic programming, but I appreciate your
help.

Steve

"Jim Cone" wrote in message
...
Steve,

The direct answer to your questions is to tell you to look at "SendKeys"
in help.
A easier method would be to set a reference to the Add-in in Tools |
References in the VBE.
That will allow you to call the macro using the run method...

Application.Run("MacroName")

Regards,
Jim Cone
San Francisco, CA

"Steve Mackay" wrote in message
...
Is it possible to force your vba code to use keyboard shortcuts - like
"CTRL
+ C" or "ALT + E + C+ENTER" instead of "Selection.Copy".
The reason why I ask is that I have an add-in menu in Excel located
between
the "Data" & "Windows" menus that I would like to access in a macro. The
shortcut would be "ALT +L+A+ENTER
Thanks,
Steve




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default force keyboard (ALT) shortcuts in VBA Code?

Steve,

If you want to paste then these work...

Application.SendKeys ("%(e)p~") ' I added the enter key

Application.SendKeys ("^(v)") ' or
Application.SendKeys ("^v") ' without the ()

Remember to do this from the spreadsheet, not from the VBE.

Also, note that there are two versions of SendKeys...
omit "Application" to send to the active window.
use "Application" to send to the application.

Experiment a little.

I still recommend Application.Run("Name of Sub")

Regards,
Jim Cone
San Francisco, CA

"Steve Mackay" wrote in message
...
Thanks for the tip. I understand it in concept but can't seem to get it to
work in practice. So, to go back to my paste example, my code would look
like this?

Sub test()
Application.SendKeys ("%ep")
End Sub

But that doesn't seem to work correctly. Can you give me an example.
Sorry, I know this is probably very basic programming, but I appreciate your
help.
Steve


"Jim Cone" wrote in message
...
Steve,

The direct answer to your questions is to tell you to look at "SendKeys"
in help.
A easier method would be to set a reference to the Add-in in Tools |
References in the VBE.
That will allow you to call the macro using the run method...

Application.Run("MacroName")

Regards,
Jim Cone
San Francisco, CA

"Steve Mackay" wrote in message
...
Is it possible to force your vba code to use keyboard shortcuts - like
"CTRL
+ C" or "ALT + E + C+ENTER" instead of "Selection.Copy".
The reason why I ask is that I have an add-in menu in Excel located
between
the "Data" & "Windows" menus that I would like to access in a macro. The
shortcut would be "ALT +L+A+ENTER
Thanks,
Steve


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default force keyboard (ALT) shortcuts in VBA Code?

Thanks,
I'll play with it a bit. I don't understand the last thing you said, but
I'll look into it.

Steve

"Jim Cone" wrote in message
...
Steve,

If you want to paste then these work...

Application.SendKeys ("%(e)p~") ' I added the enter key

Application.SendKeys ("^(v)") ' or
Application.SendKeys ("^v") ' without the ()

Remember to do this from the spreadsheet, not from the VBE.

Also, note that there are two versions of SendKeys...
omit "Application" to send to the active window.
use "Application" to send to the application.

Experiment a little.

I still recommend Application.Run("Name of Sub")

Regards,
Jim Cone
San Francisco, CA





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Keyboard Shortcuts wnfisba Excel Discussion (Misc queries) 3 December 8th 06 07:11 PM
Keyboard shortcuts Greka Excel Discussion (Misc queries) 5 July 18th 06 04:38 PM
KEYBOARD SHORTCUTS rm Excel Discussion (Misc queries) 8 May 18th 05 08:48 AM
Keyboard Shortcuts Storm2 Excel Programming 2 October 14th 04 04:54 AM
Keyboard Shortcuts Ronald Dodge Excel Programming 3 February 25th 04 03:56 PM


All times are GMT +1. The time now is 02:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"