Sendkey Button Select

HazatB

New Member
Joined
Sep 19, 2017
Messages
32
Good Morning All,

I have a sendkeys project I am nearing completion, the only issue I have currently is I get stuck on a section of the application that requires you to hit the select button. I searched google but for the most part found no solid solution. Is it possible to include a Left Click to hit the select button on the application using SendKey VBA?

Code:
Sub HazatTest()
'
' CompleteSTARandExcelSendKeyCode Macro
' Macro recorded 12/22/2010 by UMMS User
'
'
Dim EnterKey As String
Dim ThreeKey As String
Dim YesKey As String
Dim AccountKey As String
Dim rowkey As Integer
Dim Startkey As Integer
Dim CtrlKey As String
Dim HomeKey As String
Dim TimeKey As Date
Dim UpdateKey As String
Dim AltKey As String
Dim SaveKey As String
Dim XKey    As String
Dim OpenKey As String
'-------------------

EnterKey = "~"
ThreeKey = "3"
YesKey = "Y"
CtrlKey = "^"
HomeKey = "{Home}"
Startkey = "8"
TimeKey = Now()
AltKey = "%"
SaveKey = "s"
XKey = "x"
OpenKey = "o"
rowkey = Range("B1")
    
   
    AppActivate ("SendKey_HB_Testing.xlsm"), False
    Application.Sheets("Accounts").Select
    Range("D" & rowkey & ":D10000").Select
    Selection.ClearContents
    Range("F" & rowkey & ":F10000").Select
    Selection.ClearContents
             
    Range("G8:G10000").Select
    Application.CutCopyMode = False
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
    
    Range("D" & rowkey).Select
    
    
    AccountKey = Range("B" & rowkey)
    UpdateKey = Range("G" & rowkey)
   
    
    
    '================================================
    'STAR Send Key Code
    '================================================
    
    UpdateKey = Range("G" & rowkey)
    
    'Open the GL Remap
    AppActivate ("GL Account Remap"), False
    Application.Wait (Now + TimeValue("00:00:01"))
    Application.SendKeys AltKey & "(f)", True
        
    AppActivate ("GL Account Remap"), False
    Application.Wait (Now + TimeValue("00:00:01"))
    Application.SendKeys OpenKey, True
    
    AppActivate ("GL Account Remap"), False
    Application.Wait (Now + TimeValue("00:00:01"))
    Application.SendKeys ("{TAB}"), True
   
    'Update The Rule Name
    AppActivate ("GL Account Remap"), False
    Application.Wait (Now + TimeValue("00:00:01"))
    Application.SendKeys ("^a"), True
    
    'Update The Rule Name
    AppActivate ("GL Account Remap"), False
    Application.Wait (Now + TimeValue("00:00:01"))
    Application.SendKeys ("{DEL}"), True
    
    'Update The Rule Name
    AppActivate ("GL Account Remap"), False
    Application.Wait (Now + TimeValue("00:00:01"))
    Application.SendKeys (UpdateKey), True
    
    'Application.Wait (Now + TimeValue("00:00:01"))
    AppActivate ("GL Account Remap"), False
    Application.Wait (Now + TimeValue("00:00:01"))
    Application.SendKeys ("{TAB}"), True
    
    'Application.Wait (Now + TimeValue("00:00:01"))
    AppActivate ("GL Account Remap"), False
    Application.Wait (Now + TimeValue("00:00:01"))
    Application.SendKeys ("{ENTER}"), True
   
    'Save the GL Remap
    AppActivate ("GL Account Remap"), False
    Application.Wait (Now + TimeValue("00:00:01"))
    Application.SendKeys AltKey & "(f)", True
        
    AppActivate ("GL Account Remap"), False
    Application.Wait (Now + TimeValue("00:00:01"))
    Application.SendKeys SaveKey, True
    
    'Close the GL Remap
    AppActivate ("GL Account Remap"), False
    Application.Wait (Now + TimeValue("00:00:01"))
    Application.SendKeys AltKey & "(f)", True
        
    AppActivate ("GL Account Remap"), False
    Application.Wait (Now + TimeValue("00:00:01"))
    Application.SendKeys XKey, True
    
    'Notify the user the process is done.
    AppActivate ("SendKey_HB_Testing.xlsm"), False
    Application.Sheets("Accounts").Select
    MsgBox "Done", vbOKOnly
    Exit Sub

End Sub
 
Last edited:

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,215,758
Messages
6,126,717
Members
449,332
Latest member
nokoloina

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top