If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Ctl key pressed after Ctl+Tab OnKey activation

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-12-08, 19:33
savbill savbill is offline
Registered User
 
Join Date: Feb 2004
Posts: 533
Ctl key pressed after Ctl+Tab OnKey activation

I have script that sets this OnKey command then activates another open Excel Application window with an API Activate and uses SendKey commands to display the Find dialog to search for matching value.

The problem is when you activate the main Sub procedure "GoToFind()" the second time using the key combo Ctl+Tab, the Ctl key acts like it is still pressed when you select the original window. It acts like the Ctl key is still pressed until you press the Ctl key one extra time. (On the first run the Procedure is activated by the toolbar button which sets up the shortcut key command for ease of use)

The Procedure "GoToFind()" operates in 2 modes. If there's 2 Excel App windows open it goes to the open app window which is not active. If only one app window is open it goes to the Next Workbook Window in the same Excel App. So it still sets the key combo but there is not a problem as long as the same window remains the active window. The problem is related to changing application windows while the script is executing.

I don't think there's an easy answer to this, exept maybe tell the user to press the Ctl key again after using the shortcut method to activate the process.

Code:
Sub SetWinShortcutKey(strProcName As String)
  ' Set Ctl+Tab Shortcut
  Application.OnKey "^{TAB}", strProcName
  
End Sub
__________________
~

Bill
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On