I need to execute VBA script while user is logged off Windows 10, i.e. script should be executed by schedule while lock screen. Script copy charts from every excel sheet and paste them on the last sheet.
When I executed the following code while user is logged on then script finished succesfully. When I executed the following code by task scheduller while lock screen then error occured "method copy of chartobject failed". I suppose that it's connected with impossibility to use clipboard on the windows 10 lock screen.
For Each rs In ThisWorkbook.Worksheets
For Each ch In ActiveSheet.ChartObjects
ch.Copy
Sheets(Sheets.Count).Select
Cells(i, 1).Select
ActiveSheet.Pictures.Paste
Next ch
i = i + 39
Next rs
ActiveSheet
andSelect
- How to avoid using Select. – Darren Bartrup-CookActiveSheet.ChartObjects
you should users.ChartObjects
otherwise the loop through the worksheets is pretty useless. – Pᴇʜrs.ChartObjects
instead ofActiveSheet.ChartObjects
but nothing changed. It's not clear to me how to replaceActiveSheet
andSelect
to Ranges as in example – Azat Gimadiev