By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,825 Members | 2,437 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,825 IT Pros & Developers. It's quick & easy.

sendkeys to another application

P: 1
I would like use access to update another application by using the sendkeys method.

What I'm looking for is how to set the focus to the other application window and then use sendkeys to type in the account number and update the account with new information that will be stored in the access table.

Can anyone help me get started with the correct code? I've done this before but its been like 5 - 6 years and are totally drawing a blank.
Oct 27 '08 #1
Share this Question
Share on Google+
1 Reply


ADezii
Expert 5K+
P: 8,636
I would like use access to update another application by using the sendkeys method.

What I'm looking for is how to set the focus to the other application window and then use sendkeys to type in the account number and update the account with new information that will be stored in the access table.

Can anyone help me get started with the correct code? I've done this before but its been like 5 - 6 years and are totally drawing a blank.
The following code should point you in the right direction and will:
  1. Open Notepad
  2. Type the text George W. Bush into the Window
  3. Close Notepad
  4. At the Save prompt, click on Yes
  5. Save the Filename as George W. Bush (.txt will automatically be added)
  6. Click on the Save Button

Expand|Select|Wrap|Line Numbers
  1. Dim retVal As Variant
  2.  
  3. retVal = Shell("Notepad", vbNormalFocus)    'Run Notepad
  4.  
  5. SendKeys "George W. Bush"           'Type George W. Bush in Notepad Window
  6.  
  7. SendKeys "%{F4}", True              'Send ALT+F4 to close Notepad
  8.  
  9. SendKeys "{ENTER}", True            'Yes at the Save Prompt
  10.  
  11. SendKeys "George W. Bush", True     'Type Filename to Save Document to
  12.  
  13. SendKeys "%S"                       'Activates the Save Button
  14.  
Oct 27 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.