Forum Discussion
Sending Enter Key
- Apr 27, 2023
Here’s an example of how you could modify your code to send the Enter key to the external application:
VBA.Shell "Explorer.exe C:\Users\Documents\My Application", vbNormalNoFocus Application.Wait (Now + TimeValue("0:00:02")) ' Wait for 2 seconds Application.SendKeys "{ENTER}", TrueThis example, use the Application.Wait method to pause the macro for 2 seconds before sending the Enter key. This gives the external application time to open and become the active window.
Or
Application.SendKeys "{ENTER}"Please, keep in mind that the SendKeys command can sometimes be unpredictable and may not work as expected.
Alternatively, you can try using a different library file for the external application to avoid the pop-up message altogether. If that's not possible, you could consider using a different method to open the application, such as the Shell command, which may allow you to bypass the pop-up message.
I hope this helps!
Here’s an example of how you could modify your code to send the Enter key to the external application:
VBA.Shell "Explorer.exe C:\Users\Documents\My Application", vbNormalNoFocus
Application.Wait (Now + TimeValue("0:00:02")) ' Wait for 2 seconds
Application.SendKeys "{ENTER}", TrueThis example, use the Application.Wait method to pause the macro for 2 seconds before sending the Enter key. This gives the external application time to open and become the active window.
Or
Application.SendKeys "{ENTER}"Please, keep in mind that the SendKeys command can sometimes be unpredictable and may not work as expected.
Alternatively, you can try using a different library file for the external application to avoid the pop-up message altogether. If that's not possible, you could consider using a different method to open the application, such as the Shell command, which may allow you to bypass the pop-up message.
I hope this helps!
- A2Z CFApr 28, 2023Brass ContributorIt did it. Thank you so much.
- A2Z CFApr 27, 2023Brass Contributor
Great! Thank you so much. This works amazing by increasing the wait time to about 20 sec, just one problem, when the application opens, it turns off the Num Lock and Insert on the keyboard. How can this Macro turn on the Num Lock and Insert again. Thank you