If you really want to use sendkeys, you could create a windows scripting host object in your COBOL and feed it a sendkeys script created by your COBOL program. Other folks have had success (albeit ugly success) by using the SendMessage API to accomplish the same thing in a more controlled way.
Generally, I try to avoid SendKeys especially in a production environment. It relies too much on having the target window active and also has some timing-related problems.
The only reason I want to use a SendKeys type function is so that the user doesn't have to press on the OK button when a mailmerge is done through my OLE program.
This doesn't appear to be a problem on Office XP, when I execute the mailmerge it just does it. However on earlier versions of Office the print dialog box stays on the screen waiting for input - i just wanted to avoid the user having to sit watching the machine whilst it cycles through merging.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.