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?
Okay, Sleep 500 gives an error. I'm actually using another wait
Sub QuickScan() SendKeys "{F2}" Call WaitFor(6) SendKeys "%(s)" End Sub
--------------------------------------------------
Sub WaitFor(NumOfSeconds As Long)Dim SngSec As LongSngSec = Timer + NumOfSeconds
Do While Timer < SngSecDoEventsLoop
End Sub
-------------------------------
Nothing has worked. Turns out It's really not going to do me any good anyway. My new printer has an ADF so I can scan a double-sided doc but I have to tell it to use the ADF or not depending on my needs at the time.
Thanks all for the inputs though.
Ideally I could have 1 macro for single-sided and 1 for double-sided.
Myron said:Okay, Sleep 500 gives an error. I'm actually using another wait
Weird. I took that straight out of a macro I wrote that I use every day. Maybe the focus is still on the wrong window.
If you want to try again, try this:
Sub QuickScan() SendKeys "{F2}" Windows.FindWindow (Title) ' change Title to the name that shows on the scan window when it does pop up. Call WaitFor(6) 'or use the Sleep 500 here SendKeys "%(s)" End Sub
Anywho. Good luck!
I Work with Windows 10 and CorelDRAW X5, Corel PHOTO-PAINT X5
This code delete selected object
Private Sub cbDeleteObject_Click()AppActivate "Corel PHOTO-PAINT X5"'SendKeys "{DELETE}" 'permission denied'https:/stackoverflow.com/questions/2307738/sendkeys-permission-denied-error-in-visual-basicSet WshShell = CreateObject("WScript.Shell")WshShell.SendKeys "{DELETE}"'SendKeys "А" 'return errorEnd Sub
The code above work well for meGreetings!