Hi there,
I have defined an event listener for the ENTER KEY as shown in the code below. Instead of relying on my user to hit the enter key, I want to "simulate" or "trigger" the enter key being pressed in VBA code. Does anyone know how to do this?
Private Sub Workbook_Open()
Sheets("ENTRY").Activate
Application.Goto Reference:="geared_slew"
Application.OnKey "{ENTER}", "NavigateEntrySheetWithEnterKey" 'Listen for ENTER KEY events
End Sub
.
.
I attempted to find out for myself by recording a macro whilst hitting the enter key. What I don't like about using "" is that it hardcodes both the name of my excel workbook as well as the name of my Sub. Is there a better way?
Sub Macro1()
Application.Run "'Std. Data Pack Template (Slew Rings) v02.working.xlsm'!NavigateEntrySheetWithEnterKey"
End Sub
.
.
The best or "cleanest" I can fathom is the code below... but still, surely there is a simple way to just "fire the enter key" being pressed?
Sub NotGreat()
Application.Run "'" & ThisWorkbook.name & "'!" & "NavigateEntrySheetWithEnterKey"
End Sub
Thanks in advance,
Michelle
Bookmarks