473,398 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Sendkeys problem

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
2 7332
puppydogbuddy
1,923 Expert 1GB
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
8,834 Expert 8TB
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

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

Similar topics

0
by: David Kanter | last post by:
Hello, I have a question regarding SendKeys(). I am working on a small VB .Net script that manipulates/automates programs through SendKeys(). Unfortunately, I have run into several problems. ...
6
by: Mr. Bungle | last post by:
I would like to send email automatically via a command button. I have accomplished this just fine through the following code: (Outlook should already be open for reliable results) Private Sub...
2
by: RBohannon | last post by:
I need to create a report in MS Word populated with data from A2K. I have been asked to create the report in Word so that parts of it can be edited as necessary later. The data in the report are...
5
by: Mike | last post by:
I want to be able to open the printer popup screen while a report is on the screen. I would like to have a button on one of the menus that sends the "control P" combination. In the past, I...
5
by: Wayne Gibson | last post by:
Hi, Was wondering if somebody could help.. I'm trying to use Sendkeys on a Windows forms. I have entered the following command to simulate a CTRL+ALT+1.. ...
1
by: Bryan | last post by:
I am writing a C# Windows App that updates out Excel reports' modules. The app is complete, but has a problem. The only way MS allows you to unprotect the VBA code in Excel is to do it by hand or...
2
by: David Kanter | last post by:
Hi, I am relatively inexperienced with VB.Net, but I am familiar with many concepts from programming; I have some basic level of competence with C/C++ and Perl, but I just started using VB this...
6
by: Michael Maes | last post by:
Hello, I'm invoking successive SendKeys.SendWait("{BACKSPACE}") SendKeys.SendWait("{DELETE}") in a loop. The issue is that it causes a Beep on every Pass. Setting the 'Handled = True' on...
0
by: neonspark | last post by:
I'm buidling some simple macro functionality for my app so the users can record a sequence of keyboard inputs and replay them reliably via some menu. Originally, I used: protected override bool...
0
by: jairathore | last post by:
Hi, I m working on a project on which my requirment is like that remotely i control another application by using sendkey.sendwait method, i m sending some keystroke to that application and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.