Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
avantime
Creator II
Creator II

"Copy to clipboard failed" error in macro when running Task scheduler task with locked desktop

As the title says, I am having trouble running a task that copies data from a QV chart into an Excel file and saves it, via macro.

The task runs ok when I am logged on the server, but if I lock the desktop (not log out) then it throws the "Copy to clipboard error".

I have tried all the security options in Task Scheduler, installed even 3rd party task schedulers, the problem persists.

This happened after we updated the OS to Windows Server 2019, we did not experience this problem before.

Any ideas?

Labels (3)
3 Replies
marcus_sommer

I could imagine that's caused from energy-settings by enabling deeper sleep-statements immediately or after a too short time-span. This regards not only to the processor else also to the network or storage which may now not available anymore.  

avantime
Creator II
Creator II
Author

Hi Marcus, the server is housed inside a large commercial datacenter, I have asked the admins about this and they said that there are no such settings set up.. Maybe it has something to do with the security policies of WS 2019, before we had WS 2012R2 and there was no such problem.

marcus_sommer

The pure OS upgrade from 2012 to 2019 is surely not the cause but different configurations especially to the security policies may have an impact. Helpful might be to compare the previous installation + settings against the current ones and/or disabling the settings within the current one. I assume a large commercial datacenter means that everything is based on VM and also it exists a backup and so an appropriate new VM could be created for the investigation and testing.

Before I would try a few more things with the macros - maybe not with your origin one else some dummy - to check if other things are working, like exporting objects, writing into Excel, access the file-system and so on ... maybe the clipboard error is just misleading from the real cause - whereby in my experience are clipboard errors not seldom. Quite helpful could also be to add multiple WaitForIdle and Sleep statements within the macro to ensure that the previous measures are finished before the next one will access them ...