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

Sendkeys problem

P: 2
Hi All,

I'm trying to use sendkeys to paste records from the database into a another application. I am able to make Sendkeys work as a macro in access, but the problem is that the keystrokes have to be a variable equal to the record's patient number..

I tried to use sendkeys in vb but it seems vb doesnt recognize the command..
Function Macro2()

SendKeys "patient 2215", False

End Function
When I try to run it, an error message comes up "Compile Error: Expected variable or procedure, not project"

Please let me know how to fix this.

Thanks and Regards!
Feb 6 '08 #1
Share this Question
Share on Google+
2 Replies


puppydogbuddy
Expert 100+
P: 1,923
Hi All,

I'm trying to use sendkeys to paste records from the database into a another application. I am able to make Sendkeys work as a macro in access, but the problem is that the keystrokes have to be a variable equal to the record's patient number..

I tried to use sendkeys in vb but it seems vb doesnt recognize the command..
Function Macro2()

SendKeys "patient 2215", False

End Function
When I try to run it, an error message comes up "Compile Error: Expected variable or procedure, not project"

Please let me know how to fix this.

Thanks and Regards!
Try it this way:
SendKeys "patient 2215 {Enter}", False

If the above does not work and your prior macros put you in the application window, try using sendkeys to tab to the patient number field and then send the patient number

Function Macro2()
SendKeys "{Tab} {Tab} {Tab}" 'this is just an example
SendKeys "2215 {Enter}", False

End Function
Feb 10 '08 #2

ADezii
Expert 5K+
P: 8,607
Hi All,

I'm trying to use sendkeys to paste records from the database into a another application. I am able to make Sendkeys work as a macro in access, but the problem is that the keystrokes have to be a variable equal to the record's patient number..

I tried to use sendkeys in vb but it seems vb doesnt recognize the command..
Function Macro2()

SendKeys "patient 2215", False

End Function
When I try to run it, an error message comes up "Compile Error: Expected variable or procedure, not project"

Please let me know how to fix this.

Thanks and Regards!
SendKeys can only send Keystrokes to the Active Window. If you are sending Keystrokes to an External Application, you'll have to make sure it is active, as in:
Expand|Select|Wrap|Line Numbers
  1. Dim ReturnValue
  2. ReturnValue = Shell("<External App>", 1)    
  3. AppActivate ReturnValue     ' Activate the External Application
  4.  
  5. 'Now, try SendKeys
Feb 11 '08 #3

Post your reply

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