Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 309
Default Can VBA hook onto function keys???

Suppose I have a string value in Cell A1..... Can I somehow
associate the data in cell A1 with the F1 function key???

Ideally, I would like to be able to switch to other applications
and just use the function keys to grab data out of Excel
and paste the data into other apps using just the function keys.

Thank you everyone for all your tips!

Robert

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 915
Default Can VBA hook onto function keys???

Robert Crandal wrote:
Suppose I have a string value in Cell A1..... Can I somehow
associate the data in cell A1 with the F1 function key???

Ideally, I would like to be able to switch to other applications
and just use the function keys to grab data out of Excel
and paste the data into other apps using just the function keys.

Thank you everyone for all your tips!

Robert


Yes and no. You can trap the F1 key to do whatever you like /in Excel/
but other applications will do whatever F1 does there.

To your point though, you could do something like this.

In a workbook's ThisWorkbook module, place:

Private Sub Workbook_Activate()
Application.OnKey "{F1}", "CopyValueToClipboard"
End Sub


And in a standard module place (*)

Sub CopyValueToClipboard()
Dim DataObj As New MSForms.Dataobject
DataObj.SetText ActiveSheet.Range("A1").Value
DataObj.PutInClipboard
End Sub


The first procedure tells Excel to fire "CopyValueToClipboard" when F1
is pressed (pressed within Excel that is).

The second procedure places the value from A1 on the clipboard. You can
now switch to another application and paste.

(*) as seen on Chip Pearson's site:
http://www.cpearson.com/excel/Clipboard.aspx
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
Change the Function Keys JonnieMN Excel Discussion (Misc queries) 6 October 3rd 09 12:08 PM
Enable Function keys Thought I knew a lot Excel Discussion (Misc queries) 2 April 19th 09 08:03 PM
Getting a hook on Toolbar Events WhytheQ Excel Programming 4 June 9th 06 12:35 PM
hook into worksheet events temporarily? Alex Popescu Excel Programming 1 December 15th 05 01:25 PM
Using function keys in macros Tha BeatMaker[_10_] Excel Programming 2 August 19th 05 07:56 PM


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

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

About Us

"It's about Microsoft Excel"