I set up a macro to do a quick scan of docs. It basically skips through all the dialogues and ends with the image centered to the page and with the crop tool selected whereby I crop and export as needed. Worked great until I installed a new Epson all-in-one printer. Which I figured would be a little different dialogue anyway. So I thought I could just alter the code a bit.
When the scan dialogue pops up it defaults with the "scan" button highlighted but I can't just hit enter for it to actually scan. I have to click on "scan". I can however hit alt+s and scanning starts. So I change my macro to wait a few seconds for the scan dialogue to come up then SendKeys "%(s)" but it won't do it.
Any ideas?
Is this in windows 7 ?
According to some forum posts, microsoft broke VBA sendkeys in windows 7 and still has not provided an official fix.
A fix is suggested at http://yottatricks.blogspot.co.uk/2012/03/enable-send-keys-functions-in-windows-7.html
I have not tested it, but it involves a reduction of security level. This is not just for sendkeys but for everything, so might not be a good thing to do.
Equally, it is unlikely that Corel could do anything to fix this. The proper fix needs to be provided by microsoft and should not need to a involve reduction of security for other functions.
Odd that I use SendKeys in other macros. I thought it might have something to do on the Epson side.
i.e.
Sub QuickScan()
SendKeys "{F2}" 'my shortcut for scan. scan starts but will not do next
SendKeys "%(s)" or SendKeys "{ENTER}"
Oops. Yes Harry, running Win 7 pro
harryLondon said: Is this in windows 7 ? According to some forum posts, microsoft broke VBA sendkeys in windows 7 and still has not provided an official fix.
I've not had a problem with sendkeys working, I've just had to tweek how it works. Usually by throwing in a wait command every now and then. I've got 2 macros that rely heavily on send keys. One in CorelDraw and one in Microsoft Outlook. I run windows 7 32 bit.
Myron said: Odd that I use SendKeys in other macros. I thought it might have something to do on the Epson side. i.e. Sub QuickScan() SendKeys "{F2}" 'my shortcut for scan. scan starts but will not do next SendKeys "%(s)" or SendKeys "{ENTER}"
Most likely it is doing it, but doing it so fast it misses it.
Try this:
SendKeys ("{F2}") 'my shortcut for scan. scan starts but will not do next
Sleep 500 'puts in a half second pause
SendKeys ("{ENTER}")
Note that I've added parentheses around your commands.
If that doesn't work, change the 500 to 1000 or 1500.
If THAT doesn't work then I don't know.