December 5, 2020
I am working on an automation script and the last thing that's causing me grief is that I am receiving a VBA error stating there is a problem with the clipboard, but I can continue to use it. That part is true, however I am using an OnTime event to run the macro at specific times of the day (when I am not at my PC) so the debug error is stopping my script and not allowing the rest of the macro to fire. I can click Debug, then Play and it fires off the rest without a hitch, but the goal is to prevent that step as I'll be running this from an office an hour away, and driving up there to click debug+play is not really a solution I want to use.
The goal of the script is to update a report, copy it to a new workbook, save it, remove all blank rows/columns, copy the remaining range to an email as picture and then send said picture.
I have used Application.CutCopyMode = False in multiple places prior to the copy to "clear the clipboard" as well as Application.Displayalerts = False and Application.EnableEvents = False
When I manually run the macro, it works as it is supposed to.
If my PC/screen is locked, is this expected behavior? **Edit** I created a two minute loop of the same script, worked fine 4 times in a row then locked my PC and errored immediately, so I suspect this is my problem. My office PC has an automatic-mouse mover so it won't auto-lock, but just in case I would like to know of anything else as a backup, just in case.**
I appreciate any assistance you can provide. Thank you.
November 8, 2013
A code should be able to run, even if you switch to a different user account to the same computer. I do this frequently, I keep code running in a different account then switch to my user account to use excel separately than the other user instance, switching accounts goes through user sign-in unlock screen.
Try ignoring the error with On Error Resume Next.